home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / texinfo / texinfo.tex (.txt) < prev    next >
LaTeX Document  |  1994-01-28  |  131KB  |  3,186 lines

  1. %% TeX macros to handle texinfo files
  2. %   Copyright (C) 1985, 86, 88, 90, 91, 92, 1993 Free Software Foundation, Inc.
  3. %This texinfo.tex file is free software; you can redistribute it and/or
  4. %modify it under the terms of the GNU General Public License as
  5. %published by the Free Software Foundation; either version 2, or (at
  6. %your option) any later version.
  7. %This texinfo.tex file is distributed in the hope that it will be
  8. %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  9. %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  10. %General Public License for more details.
  11. %You should have received a copy of the GNU General Public License
  12. %along with this texinfo.tex file; see the file COPYING.  If not, write
  13. %to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
  14. %USA.
  15. %In other words, you are welcome to use, share and improve this program.
  16. %You are forbidden to forbid anyone else to use, share and improve
  17. %what you give them.   Help stamp out software-hoarding!
  18. \def\texinfoversion{2.108}
  19. \message{Loading texinfo package [Version \texinfoversion]:}
  20. % Print the version number if in a .fmt file.
  21. \everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
  22. % Save some parts of plain tex whose names we will redefine.
  23. \let\ptexlbrace=\{
  24. \let\ptexrbrace=\}
  25. \let\ptexdots=\dots
  26. \let\ptexdot=\.
  27. \let\ptexstar=\*
  28. \let\ptexend=\end
  29. \let\ptexbullet=\bullet
  30. \let\ptexb=\b
  31. \let\ptexc=\c
  32. \let\ptexi=\i
  33. \let\ptext=\t
  34. \let\ptexl=\l
  35. \let\ptexL=\L
  36. \def\tie{\penalty 10000\ }     % Save plain tex definition of ~.
  37. \message{Basics,}
  38. \chardef\other=12
  39. % If this character appears in an error message or help string, it
  40. % starts a new line in the output.
  41. \newlinechar = `^^J
  42. % Ignore a token.
  43. \def\gobble#1{}
  44. \hyphenation{ap-pen-dix}
  45. \hyphenation{mini-buf-fer mini-buf-fers}
  46. \hyphenation{eshell}
  47. % Margin to add to right of even pages, to left of odd pages.
  48. \newdimen \bindingoffset  \bindingoffset=0pt
  49. \newdimen \normaloffset   \normaloffset=\hoffset
  50. \newdimen\pagewidth \newdimen\pageheight
  51. \pagewidth=\hsize \pageheight=\vsize
  52. % Sometimes it is convenient to have everything in the transcript file
  53. % and nothing on the terminal.  We don't just call \tracingall here,
  54. % since that produces some useless output on the terminal.
  55. \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  56. \def\loggingall{\tracingcommands2 \tracingstats2
  57.    \tracingpages1 \tracingoutput1 \tracinglostchars1
  58.    \tracingmacros2 \tracingparagraphs1 \tracingrestores1
  59.    \showboxbreadth\maxdimen\showboxdepth\maxdimen
  60. %---------------------Begin change-----------------------
  61. %%%% For @cropmarks command.
  62. % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
  63. \newdimen\cornerlong \newdimen\cornerthick
  64. \newdimen \topandbottommargin
  65. \newdimen \outerhsize \newdimen \outervsize
  66. \cornerlong=1pc\cornerthick=.3pt    % These set size of cropmarks
  67. \outerhsize=7in
  68. %\outervsize=9.5in
  69. % Alternative @smallbook page size is 9.25in
  70. \outervsize=9.25in
  71. \topandbottommargin=.75in
  72. %---------------------End change-----------------------
  73. % \onepageout takes a vbox as an argument.  Note that \pagecontents
  74. % does insertions itself, but you have to call it yourself.
  75. \chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
  76. \def\onepageout#1{\hoffset=\normaloffset
  77. \ifodd\pageno  \advance\hoffset by \bindingoffset
  78. \else \advance\hoffset by -\bindingoffset\fi
  79. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  80. \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
  81. {\let\hsize=\pagewidth \makefootline}}}%
  82. \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  83. %%%% For @cropmarks command %%%%
  84. % Here is a modification of the main output routine for Near East Publications
  85. % This provides right-angle cropmarks at all four corners.
  86. % The contents of the page are centerlined into the cropmarks,
  87. % and any desired binding offset is added as an \hskip on either
  88. % site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
  89. \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
  90. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  91.          \shipout
  92.          \vbox to \outervsize{\hsize=\outerhsize
  93.                  \vbox{\line{\ewtop\hfill\ewtop}}
  94.                  \nointerlineskip
  95.                  \line{\vbox{\moveleft\cornerthick\nstop}
  96.                        \hfill
  97.                        \vbox{\moveright\cornerthick\nstop}}
  98.                  \vskip \topandbottommargin
  99.                  \centerline{\ifodd\pageno\hskip\bindingoffset\fi
  100.             \vbox{
  101.             {\let\hsize=\pagewidth \makeheadline}
  102.             \pagebody{#1}
  103.             {\let\hsize=\pagewidth \makefootline}}
  104.             \ifodd\pageno\else\hskip\bindingoffset\fi}
  105.          \vskip \topandbottommargin plus1fill minus1fill
  106.                  \boxmaxdepth\cornerthick
  107.                  \line{\vbox{\moveleft\cornerthick\nsbot}
  108.                        \hfill
  109.                        \vbox{\moveright\cornerthick\nsbot}}
  110.                  \nointerlineskip
  111.                  \vbox{\line{\ewbot\hfill\ewbot}}
  112.   \advancepageno
  113.   \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  114. % Do @cropmarks to get crop marks
  115. \def\cropmarks{\let\onepageout=\croppageout }
  116. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  117. {\catcode`\@ =11
  118. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  119. \dimen@=\dp#1 \unvbox#1
  120. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  121. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  122. % Here are the rules for the cropmarks.  Note that they are
  123. % offset so that the space between them is truly \outerhsize or \outervsize
  124. % (P. A. MacKay, 12 November, 1986)
  125. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  126. \def\nstop{\vbox
  127.   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  128. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  129. \def\nsbot{\vbox
  130.   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  131. % Parse an argument, then pass it to #1.  The argument is the rest of
  132. % the input line (except we remove a trailing comment).  #1 should be a
  133. % macro which expects an ordinary undelimited TeX argument.
  134. \def\parsearg#1{%
  135.   \let\next = #1%
  136.   \begingroup
  137.     \obeylines
  138.     \futurelet\temp\parseargx
  139. % If the next token is an obeyed space (from an @example environment or
  140. % the like), remove it and recurse.  Otherwise, we're done.
  141. \def\parseargx{%
  142.   % \obeyedspace is defined far below, after the definition of \sepspaces.
  143.   \ifx\obeyedspace\temp
  144.     \expandafter\parseargdiscardspace
  145.   \else
  146.     \expandafter\parseargline
  147.   \fi
  148. % Remove a single space (as the delimiter token to the macro call).
  149. {\obeyspaces %
  150.  \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
  151. {\obeylines %
  152.   \gdef\parseargline#1^^M{%
  153.     \endgroup % End of the group started in \parsearg.
  154.     %
  155.     % First remove any @c comment, then any @comment.
  156.     % Result of each macro is put in \toks0.
  157.     \argremovec #1\c\relax %
  158.     \expandafter\argremovecomment \the\toks0 \comment\relax %
  159.     %
  160.     % Call the caller's macro, saved as \next in \parsearg.
  161.     \expandafter\next\expandafter{\the\toks0}%
  162. % Since all \c{,omment} does is throw away the argument, we can let TeX
  163. % do that for us.  The \relax here is matched by the \relax in the call
  164. % in \parseargline; it could be more or less anything, its purpose is
  165. % just to delimit the argument to the \c.
  166. \def\argremovec#1\c#2\relax{\toks0 = {#1}}
  167. \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
  168. % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
  169. %    @end itemize  @c foo
  170. % will have two active spaces as part of the argument with the
  171. % `itemize'.  Here we remove all active spaces from #1, and assign the
  172. % result to \toks0.
  173. % This loses if there are any *other* active characters besides spaces
  174. % in the argument -- _ ^ +, for example -- since they get expanded.
  175. % Fortunately, Texinfo does not define any such commands.  (If it ever
  176. % does, the catcode of the characters in questionwill have to be changed
  177. % here.)  But this means we cannot call \removeactivespaces as part of
  178. % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
  179. % that \parsearg gets might well have any character at all in it.
  180. \def\removeactivespaces#1{%
  181.   \begingroup
  182.     \ignoreactivespaces
  183.     \edef\temp{#1}%
  184.     \global\toks0 = \expandafter{\temp}%
  185.   \endgroup
  186. % Change the active space to expand to nothing.
  187. \begingroup
  188.   \obeyspaces
  189.   \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
  190. \endgroup
  191. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  192. %% These are used to keep @begin/@end levels from running away
  193. %% Call \inENV within environments (after a \begingroup)
  194. \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  195. \def\ENVcheck{%
  196. \ifENV\errmessage{Still within an environment.  Type Return to continue.}
  197. \endgroup\fi} % This is not perfect, but it should reduce lossage
  198. % @begin foo  is the same as @foo, for now.
  199. \newhelp\EMsimple{Type <Return> to continue.}
  200. \outer\def\begin{\parsearg\beginxxx}
  201. \def\beginxxx #1{%
  202. \expandafter\ifx\csname #1\endcsname\relax
  203. {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  204. \csname #1\endcsname\fi}
  205. % @end foo executes the definition of \Efoo.
  206. \def\end{\parsearg\endxxx}
  207. \def\endxxx #1{%
  208.   \removeactivespaces{#1}%
  209.   \edef\endthing{\the\toks0}%
  210.   \expandafter\ifx\csname E\endthing\endcsname\relax
  211.     \expandafter\ifx\csname \endthing\endcsname\relax
  212.       % There's no \foo, i.e., no ``environment'' foo.
  213.       \errhelp = \EMsimple
  214.       \errmessage{Undefined command `@end \endthing'}%
  215.     \else
  216.       \unmatchedenderror\endthing
  217.     \fi
  218.   \else
  219.     % Everything's ok; the right environment has been started.
  220.     \csname E\endthing\endcsname
  221.   \fi
  222. % There is an environment #1, but it hasn't been started.  Give an error.
  223. \def\unmatchedenderror#1{%
  224.   \errhelp = \EMsimple
  225.   \errmessage{This `@end #1' doesn't have a matching `@#1'}%
  226. % Define the control sequence \E#1 to give an unmatched @end error.
  227. \def\defineunmatchedend#1{%
  228.   \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
  229. % Single-spacing is done by various environments (specifically, in
  230. % \nonfillstart and \quotations).
  231. \newskip\singlespaceskip \singlespaceskip = \baselineskip
  232. \def\singlespace{%
  233. % Why was this kern here?  It messes up equalizing space above and below
  234. % environments.  --karl, 6may93
  235. %{\advance \baselineskip by -\singlespaceskip
  236. %\kern \baselineskip}%
  237. \baselineskip=\singlespaceskip
  238. %% Simple single-character @ commands
  239. % @@ prints an @
  240. % Kludge this until the fonts are right (grr).
  241. \def\@{{\tt \char '100}}
  242. % This is turned off because it was never documented
  243. % and you can use @w{...} around a quote to suppress ligatures.
  244. %% Define @` and @' to be the same as ` and '
  245. %% but suppressing ligatures.
  246. %\def\`{{`}}
  247. %\def\'{{'}}
  248. % Used to generate quoted braces.
  249. \def\mylbrace {{\tt \char '173}}
  250. \def\myrbrace {{\tt \char '175}}
  251. \let\{=\mylbrace
  252. \let\}=\myrbrace
  253. % @: forces normal size whitespace following.
  254. \def\:{\spacefactor=1000 }
  255. % @* forces a line break.
  256. \def\*{\hfil\break\hbox{}\ignorespaces}
  257. % @. is an end-of-sentence period.
  258. \def\.{.\spacefactor=3000 }
  259. % @w prevents a word break.  Without the \leavevmode, @w at the
  260. % beginning of a paragraph, when TeX is still in vertical mode, would
  261. % produce a whole line of output instead of starting the paragraph.
  262. \def\w#1{\leavevmode\hbox{#1}}
  263. % @group ... @end group forces ... to be all on one page, by enclosing
  264. % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
  265. % to keep its height that of a normal line.  According to the rules for
  266. % \topskip (p.114 of the TeXbook), the glue inserted is
  267. % max (\topskip - \ht (first item), 0).  If that height is large,
  268. % therefore, no glue is inserted, and the space between the headline and
  269. % the text is small, which looks bad.
  270. \def\group{\begingroup
  271.   \ifnum\catcode13=\active \else
  272.     \errhelp = \groupinvalidhelp
  273.     \errmessage{@group invalid in context where filling is enabled}%
  274.   \fi
  275.   % The \vtop we start below produces a box with normal height and large
  276.   % depth; thus, TeX puts \baselineskip glue before it, and (when the
  277.   % next line of text is done) \lineskip glue after it.  (See p.82 of
  278.   % the TeXbook.)  Thus, space below is not quite equal to space
  279.   % above.  But it's pretty close.
  280.   \def\Egroup{%
  281.     \egroup           % End the \vtop.
  282.     \endgroup         % End the \group.
  283.   \vtop\bgroup
  284.     % We have to put a strut on the last line in case the @group is in
  285.     % the midst of an example, rather than completely enclosing it.
  286.     % Otherwise, the interline space between the last line of the group
  287.     % and the first line afterwards is too small.  But we can't put the
  288.     % strut in \Egroup, since there it would be on a line by itself.
  289.     % Hence this just inserts a strut at the beginning of each line.
  290.     \everypar = {\strut}%
  291.     %
  292.     % Since we have a strut on every line, we don't need any of TeX's
  293.     % normal interline spacing.
  294.     \offinterlineskip
  295.     %
  296.     % OK, but now we have to do something about blank
  297.     % lines in the input in @example-like environments, which normally
  298.     % just turn into \lisppar, which will insert no space now that we've
  299.     % turned off the interline space.  Simplest is to make them be an
  300.     % empty paragraph.
  301.     \ifx\par\lisppar
  302.       \edef\par{\leavevmode \par}%
  303.       %
  304.       % Reset ^^M's definition to new definition of \par.
  305.       \obeylines
  306.     \fi
  307.     %
  308.     % We do @comment here in case we are called inside an environment,
  309.     % such as @example, where each end-of-line in the input causes an
  310.     % end-of-line in the output.  We don't want the end-of-line after
  311.     % the `@group' to put extra space in the output.  Since @group
  312.     % should appear on a line by itself (according to the Texinfo
  313.     % manual), we don't worry about eating any user text.
  314.     \comment
  315. % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  316. % message, so this ends up printing `@group can only ...'.
  317. \newhelp\groupinvalidhelp{%
  318. group can only be used in environments such as @example,^^J%
  319. where each line of input produces a line of output.}
  320. % @need space-in-mils
  321. % forces a page break if there is not space-in-mils remaining.
  322. \newdimen\mil  \mil=0.001in
  323. \def\need{\parsearg\needx}
  324. % Old definition--didn't work.
  325. %\def\needx #1{\par %
  326. %% This method tries to make TeX break the page naturally
  327. %% if the depth of the box does not fit.
  328. %{\baselineskip=0pt%
  329. %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
  330. %\prevdepth=-1000pt
  331. \def\needx#1{%
  332.   % Go into vertical mode, so we don't make a big box in the middle of a
  333.   % paragraph.
  334.   \par
  335.   % Don't add any leading before our big empty box, but allow a page
  336.   % break, since the best break might be right here.
  337.   \allowbreak
  338.   \nointerlineskip
  339.   \vtop to #1\mil{\vfil}%
  340.   % TeX does not even consider page breaks if a penalty added to the
  341.   % main vertical list is 10000 or more.  But in order to see if the
  342.   % empty box we just added fits on the page, we must make it consider
  343.   % page breaks.  On the other hand, we don't want to actually break the
  344.   % page after the empty box.  So we use a penalty of 9999.
  345.   % There is an extremely small chance that TeX will actually break the
  346.   % page at this \penalty, if there are no other feasible breakpoints in
  347.   % sight.  (If the user is using lots of big @group commands, which
  348.   % almost-but-not-quite fill up a page, TeX will have a hard time doing
  349.   % good page breaking, for example.)  However, I could not construct an
  350.   % example where a page broke at this \penalty; if it happens in a real
  351.   % document, then we can reconsider our strategy.
  352.   \penalty9999
  353.   % Back up by the size of the box, whether we did a page break or not.
  354.   \kern -#1\mil
  355.   % Do not allow a page break right after this kern.
  356.   \nobreak
  357. % @br   forces paragraph break
  358. \let\br = \par
  359. % @dots{}  output some dots
  360. \def\dots{$\ldots$}
  361. % @page    forces the start of a new page
  362. \def\page{\par\vfill\supereject}
  363. % @exdent text....
  364. % outputs text on separate line in roman font, starting at standard page margin
  365. % This records the amount of indent in the innermost environment.
  366. % That's how much \exdent should take out.
  367. \newskip\exdentamount
  368. % This defn is used inside fill environments such as @defun.
  369. \def\exdent{\parsearg\exdentyyy}
  370. \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
  371. % This defn is used inside nofill environments such as @example.
  372. \def\nofillexdent{\parsearg\nofillexdentyyy}
  373. \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
  374. \leftline{\hskip\leftskip{\rm#1}}}}
  375. %\hbox{{\rm#1}}\hfil\break}}
  376. % @include file    insert text of that file as input.
  377. \def\include{\parsearg\includezzz}
  378. %Use \input\thisfile to avoid blank after \input, which may be an active
  379. %char (in which case the blank would become the \input argument).
  380. %The grouping keeps the value of \thisfile correct even when @include
  381. %is nested.
  382. \def\includezzz #1{\begingroup
  383. \def\thisfile{#1}\input\thisfile
  384. \endgroup}
  385. \def\thisfile{}
  386. % @center line   outputs that line, centered
  387. \def\center{\parsearg\centerzzz}
  388. \def\centerzzz #1{{\advance\hsize by -\leftskip
  389. \advance\hsize by -\rightskip
  390. \centerline{#1}}}
  391. % @sp n   outputs n lines of vertical space
  392. \def\sp{\parsearg\spxxx}
  393. \def\spxxx #1{\par \vskip #1\baselineskip}
  394. % @comment ...line which is ignored...
  395. % @c is the same as @comment
  396. % @ignore ... @end ignore  is another way to write a comment
  397. \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
  398. \parsearg \commentxxx}
  399. \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
  400. \let\c=\comment
  401. % Prevent errors for section commands.
  402. % Used in @ignore and in failing conditionals.
  403. \def\ignoresections{%
  404. \let\chapter=\relax
  405. \let\unnumbered=\relax
  406. \let\top=\relax
  407. \let\unnumberedsec=\relax
  408. \let\unnumberedsection=\relax
  409. \let\unnumberedsubsec=\relax
  410. \let\unnumberedsubsection=\relax
  411. \let\unnumberedsubsubsec=\relax
  412. \let\unnumberedsubsubsection=\relax
  413. \let\section=\relax
  414. \let\subsec=\relax
  415. \let\subsubsec=\relax
  416. \let\subsection=\relax
  417. \let\subsubsection=\relax
  418. \let\appendix=\relax
  419. \let\appendixsec=\relax
  420. \let\appendixsection=\relax
  421. \let\appendixsubsec=\relax
  422. \let\appendixsubsection=\relax
  423. \let\appendixsubsubsec=\relax
  424. \let\appendixsubsubsection=\relax
  425. \let\contents=\relax
  426. \let\smallbook=\relax
  427. \let\titlepage=\relax
  428. % Used in nested conditionals, where we have to parse the Texinfo source
  429. % and so want to turn off most commands, in case they are used
  430. % incorrectly.
  431. \def\ignoremorecommands{%
  432.   \let\defcv = \relax
  433.   \let\deffn = \relax
  434.   \let\deffnx = \relax
  435.   \let\defindex = \relax
  436.   \let\defivar = \relax
  437.   \let\defmac = \relax
  438.   \let\defmethod = \relax
  439.   \let\defop = \relax
  440.   \let\defopt = \relax
  441.   \let\defspec = \relax
  442.   \let\deftp = \relax
  443.   \let\deftypefn = \relax
  444.   \let\deftypefun = \relax
  445.   \let\deftypevar = \relax
  446.   \let\deftypevr = \relax
  447.   \let\defun = \relax
  448.   \let\defvar = \relax
  449.   \let\defvr = \relax
  450.   \let\ref = \relax
  451.   \let\xref = \relax
  452.   \let\printindex = \relax
  453.   \let\pxref = \relax
  454.   \let\settitle = \relax
  455.   \let\include = \relax
  456.   \let\lowersections = \relax
  457.   \let\down = \relax
  458.   \let\raisesections = \relax
  459.   \let\up = \relax
  460.   \let\set = \relax
  461.   \let\clear = \relax
  462. % Ignore @ignore ... @end ignore.
  463. \def\ignore{\doignore{ignore}}
  464. % Also ignore @ifinfo, @menu, and @direntry text.
  465. \def\ifinfo{\doignore{ifinfo}}
  466. \def\menu{\doignore{menu}}
  467. \def\direntry{\doignore{direntry}}
  468. % Ignore text until a line `@end #1'.
  469. \def\doignore#1{\begingroup
  470.   % Don't complain about control sequences we have declared \outer.
  471.   \ignoresections
  472.   % Define a command to swallow text until we reach `@end #1'.
  473.   \long\def\doignoretext##1\end #1{\enddoignore}%
  474.   % Make sure that spaces turn into tokens that match what \doignoretext wants.
  475.   \catcode32 = 10
  476.   % And now expand that command.
  477.   \doignoretext
  478. % What we do to finish off ignored text.
  479. \def\enddoignore{\endgroup\ignorespaces}%
  480. \newif\ifwarnedobs\warnedobsfalse
  481. \def\obstexwarn{%
  482.   \ifwarnedobs\relax\else
  483.   % We need to warn folks that they may have trouble with TeX 3.0.
  484.   % This uses \immediate\write16 rather than \message to get newlines.
  485.     \immediate\write16{}
  486.     \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
  487.     \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
  488.     \immediate\write16{If you are running another version of TeX, relax.}
  489.     \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
  490.     \immediate\write16{  Then upgrade your TeX installation if you can.}
  491.     \immediate\write16{If you are stuck with version 3.0, run the}
  492.     \immediate\write16{  script ``tex3patch'' from the Texinfo distribution}
  493.     \immediate\write16{  to use a workaround.}
  494.     \immediate\write16{}
  495.     \warnedobstrue
  496.     \fi
  497. % **In TeX 3.0, setting text in \nullfont hangs tex.  For a
  498. % workaround (which requires the file ``dummy.tfm'' to be installed),
  499. % uncomment the following line:
  500. %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
  501. % Ignore text, except that we keep track of conditional commands for
  502. % purposes of nesting, up to an `@end #1' command.
  503. \def\nestedignore#1{%
  504.   \obstexwarn
  505.   % We must actually expand the ignored text to look for the @end
  506.   % command, so that nested ignore constructs work.  Thus, we put the
  507.   % text into a \vbox and then do nothing with the result.  To minimize
  508.   % the change of memory overflow, we follow the approach outlined on
  509.   % page 401 of the TeXbook: make the current font be a dummy font.
  510.   \setbox0 = \vbox\bgroup
  511.     % Don't complain about control sequences we have declared \outer.
  512.     \ignoresections
  513.     %
  514.     % Define `@end #1' to end the box, which will in turn undefine the
  515.     % @end command again.
  516.     \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
  517.     %
  518.     % We are going to be parsing Texinfo commands.  Most cause no
  519.     % trouble when they are used incorrectly, but some commands do
  520.     % complicated argument parsing or otherwise get confused, so we
  521.     % undefine them.
  522.     %
  523.     % We can't do anything about stray @-signs, unfortunately;
  524.     % they'll produce `undefined control sequence' errors.
  525.     \ignoremorecommands
  526.     %
  527.     % Set the current font to be \nullfont, a TeX primitive, and define
  528.     % all the font commands to also use \nullfont.  We don't use
  529.     % dummy.tfm, as suggested in the TeXbook, because not all sites
  530.     % might have that installed.  Therefore, math mode will still
  531.     % produce output, but that should be an extremely small amount of
  532.     % stuff compared to the main input.
  533.     %
  534.     \nullfont
  535.     \let\tenrm = \nullfont  \let\tenit = \nullfont  \let\tensl = \nullfont
  536.     \let\tenbf = \nullfont  \let\tentt = \nullfont  \let\smallcaps = \nullfont
  537.     \let\tensf = \nullfont
  538.     %
  539.     % Don't complain when characters are missing from the fonts.
  540.     \tracinglostchars = 0
  541.     %
  542.     % Don't bother to do space factor calculations.
  543.     \frenchspacing
  544.     %
  545.     % Don't report underfull hboxes.
  546.     \hbadness = 10000
  547.     %
  548.     % Do minimal line-breaking.
  549.     \pretolerance = 10000
  550.     %
  551.     % Do not execute instructions in @tex
  552.     \def\tex{\doignore{tex}}
  553. % @set VAR sets the variable VAR to an empty value.
  554. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  555. % Since we want to separate VAR from REST-OF-LINE (which might be
  556. % empty), we can't just use \parsearg; we have to insert a space of our
  557. % own to delimit the rest of the line, and then take it out again if we
  558. % didn't need it.
  559. \def\set{\parsearg\setxxx}
  560. \def\setxxx#1{\setyyy#1 \endsetyyy}
  561. \def\setyyy#1 #2\endsetyyy{%
  562.   \def\temp{#2}%
  563.   \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
  564.   \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
  565.   \fi
  566. \def\setzzz#1#2 \endsetzzz{\expandafter\xdef\csname SET#1\endcsname{#2}}
  567. % @clear VAR clears (i.e., unsets) the variable VAR.
  568. \def\clear{\parsearg\clearxxx}
  569. \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
  570. % @value{foo} gets the text saved in variable foo.
  571. \def\value#1{\expandafter
  572.         \ifx\csname SET#1\endcsname\relax
  573.             {\{No value for ``#1''\}}
  574.         \else \csname SET#1\endcsname \fi}
  575. % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  576. % with @set.
  577. \def\ifset{\parsearg\ifsetxxx}
  578. \def\ifsetxxx #1{%
  579.   \expandafter\ifx\csname SET#1\endcsname\relax
  580.     \expandafter\ifsetfail
  581.   \else
  582.     \expandafter\ifsetsucceed
  583.   \fi
  584. \def\ifsetsucceed{\conditionalsucceed{ifset}}
  585. \def\ifsetfail{\nestedignore{ifset}}
  586. \defineunmatchedend{ifset}
  587. % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
  588. % defined with @set, or has been undefined with @clear.
  589. \def\ifclear{\parsearg\ifclearxxx}
  590. \def\ifclearxxx #1{%
  591.   \expandafter\ifx\csname SET#1\endcsname\relax
  592.     \expandafter\ifclearsucceed
  593.   \else
  594.     \expandafter\ifclearfail
  595.   \fi
  596. \def\ifclearsucceed{\conditionalsucceed{ifclear}}
  597. \def\ifclearfail{\nestedignore{ifclear}}
  598. \defineunmatchedend{ifclear}
  599. % @iftex always succeeds; we read the text following, through @end
  600. % iftex).  But `@end iftex' should be valid only after an @iftex.
  601. \def\iftex{\conditionalsucceed{iftex}}
  602. \defineunmatchedend{iftex}
  603. % We can't just want to start a group at @iftex (for example) and end it
  604. % at @end iftex, since then @set commands inside the conditional have no
  605. % effect (they'd get reverted at the end of the group).  So we must
  606. % define \Eiftex to redefine itself to be its previous value.  (We can't
  607. % just define it to fail again with an ``unmatched end'' error, since
  608. % the @ifset might be nested.)
  609. \def\conditionalsucceed#1{%
  610.   \edef\temp{%
  611.     % Remember the current value of \E#1.
  612.     \let\nece{prevE#1} = \nece{E#1}%
  613.     %
  614.     % At the `@end #1', redefine \E#1 to be its previous value.
  615.     \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
  616.   \temp
  617. % We need to expand lots of \csname's, but we don't want to expand the
  618. % control sequences after we've constructed them.
  619. \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
  620. % @asis just yields its argument.  Used with @table, for example.
  621. \def\asis#1{#1}
  622. % @math means output in math mode.
  623. % We don't use $'s directly in the definition of \math because control
  624. % sequences like \math are expanded when the toc file is written.  Then,
  625. % we read the toc file back, the $'s will be normal characters (as they
  626. % should be, according to the definition of Texinfo).  So we must use a
  627. % control sequence to switch into and out of math mode.
  628. % This isn't quite enough for @math to work properly in indices, but it
  629. % seems unlikely it will ever be needed there.
  630. \let\implicitmath = $
  631. \def\math#1{\implicitmath #1\implicitmath}
  632. % @bullet and @minus need the same treatment as @math, just above.
  633. \def\bullet{\implicitmath\ptexbullet\implicitmath}
  634. \def\minus{\implicitmath-\implicitmath}
  635. \def\node{\ENVcheck\parsearg\nodezzz}
  636. \def\nodezzz#1{\nodexxx [#1,]}
  637. \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
  638. \let\nwnode=\node
  639. \let\lastnode=\relax
  640. \def\donoderef{\ifx\lastnode\relax\else
  641. \expandafter\expandafter\expandafter\setref{\lastnode}\fi
  642. \let\lastnode=\relax}
  643. \def\unnumbnoderef{\ifx\lastnode\relax\else
  644. \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
  645. \let\lastnode=\relax}
  646. \def\appendixnoderef{\ifx\lastnode\relax\else
  647. \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
  648. \let\lastnode=\relax}
  649. \let\refill=\relax
  650. % @setfilename is done at the beginning of every texinfo file.
  651. % So open here the files we need to have open while reading the input.
  652. % This makes it possible to make a .fmt file for texinfo.
  653. \def\setfilename{%
  654.    \readauxfile
  655.    \opencontents
  656.    \openindices
  657.    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  658.    \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  659.    \comment % Ignore the actual filename.
  660. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  661. \def\inforef #1{\inforefzzz #1,,,,**}
  662. \def\inforefzzz #1,#2,#3,#4**{See Info file \file{\ignorespaces #3{}},
  663.   node \samp{\ignorespaces#1{}}}
  664. \message{fonts,}
  665. % Font-change commands.
  666. % Texinfo supports the sans serif font style, which plain TeX does not.
  667. % So we set up a \sf analogous to plain's \rm, etc.
  668. \newfam\sffam
  669. \def\sf{\fam=\sffam \tensf}
  670. \let\li = \sf % Sometimes we call it \li, not \sf.
  671. %% Try out Computer Modern fonts at \magstephalf
  672. \let\mainmagstep=\magstephalf
  673. \ifx\bigger\relax
  674. \let\mainmagstep=\magstep1
  675. \font\textrm=cmr12
  676. \font\texttt=cmtt12
  677. \else
  678. \font\textrm=cmr10 scaled \mainmagstep
  679. \font\texttt=cmtt10 scaled \mainmagstep
  680. % Instead of cmb10, you many want to use cmbx10.
  681. % cmbx10 is a prettier font on its own, but cmb10
  682. % looks better when embedded in a line with cmr10.
  683. \font\textbf=cmb10 scaled \mainmagstep
  684. \font\textit=cmti10 scaled \mainmagstep
  685. \font\textsl=cmsl10 scaled \mainmagstep
  686. \font\textsf=cmss10 scaled \mainmagstep
  687. \font\textsc=cmcsc10 scaled \mainmagstep
  688. \font\texti=cmmi10 scaled \mainmagstep
  689. \font\textsy=cmsy10 scaled \mainmagstep
  690. % A few fonts for @defun, etc.
  691. \font\defbf=cmbx10 scaled \magstep1 %was 1314
  692. \font\deftt=cmtt10 scaled \magstep1
  693. \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
  694. % Fonts for indices and small examples.
  695. % We actually use the slanted font rather than the italic,
  696. % because texinfo normally uses the slanted fonts for that.
  697. % Do not make many font distinctions in general in the index, since they
  698. % aren't very useful.
  699. \font\ninett=cmtt9
  700. \font\indrm=cmr9
  701. \font\indit=cmsl9
  702. \let\indsl=\indit
  703. \let\indtt=\ninett
  704. \let\indsf=\indrm
  705. \let\indbf=\indrm
  706. \let\indsc=\indrm
  707. \font\indi=cmmi9
  708. \font\indsy=cmsy9
  709. % Fonts for headings
  710. \font\chaprm=cmbx12 scaled \magstep2
  711. \font\chapit=cmti12 scaled \magstep2
  712. \font\chapsl=cmsl12 scaled \magstep2
  713. \font\chaptt=cmtt12 scaled \magstep2
  714. \font\chapsf=cmss12 scaled \magstep2
  715. \let\chapbf=\chaprm
  716. \font\chapsc=cmcsc10 scaled\magstep3
  717. \font\chapi=cmmi12 scaled \magstep2
  718. \font\chapsy=cmsy10 scaled \magstep3
  719. \font\secrm=cmbx12 scaled \magstep1
  720. \font\secit=cmti12 scaled \magstep1
  721. \font\secsl=cmsl12 scaled \magstep1
  722. \font\sectt=cmtt12 scaled \magstep1
  723. \font\secsf=cmss12 scaled \magstep1
  724. \font\secbf=cmbx12 scaled \magstep1
  725. \font\secsc=cmcsc10 scaled\magstep2
  726. \font\seci=cmmi12 scaled \magstep1
  727. \font\secsy=cmsy10 scaled \magstep2
  728. % \font\ssecrm=cmbx10 scaled \magstep1    % This size an font looked bad.
  729. % \font\ssecit=cmti10 scaled \magstep1    % The letters were too crowded.
  730. % \font\ssecsl=cmsl10 scaled \magstep1
  731. % \font\ssectt=cmtt10 scaled \magstep1
  732. % \font\ssecsf=cmss10 scaled \magstep1
  733. %\font\ssecrm=cmb10 scaled 1315    % Note the use of cmb rather than cmbx.
  734. %\font\ssecit=cmti10 scaled 1315    % Also, the size is a little larger than
  735. %\font\ssecsl=cmsl10 scaled 1315    % being scaled magstep1.
  736. %\font\ssectt=cmtt10 scaled 1315
  737. %\font\ssecsf=cmss10 scaled 1315
  738. %\let\ssecbf=\ssecrm
  739. \font\ssecrm=cmbx12 scaled \magstephalf
  740. \font\ssecit=cmti12 scaled \magstephalf
  741. \font\ssecsl=cmsl12 scaled \magstephalf
  742. \font\ssectt=cmtt12 scaled \magstephalf
  743. \font\ssecsf=cmss12 scaled \magstephalf
  744. \font\ssecbf=cmbx12 scaled \magstephalf
  745. \font\ssecsc=cmcsc10 scaled \magstep1
  746. \font\sseci=cmmi12 scaled \magstephalf
  747. \font\ssecsy=cmsy10 scaled \magstep1
  748. % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
  749. % but that is not a standard magnification.
  750. % Fonts for title page:
  751. \font\titlerm = cmbx12 scaled \magstep3
  752. \let\authorrm = \secrm
  753. % In order for the font changes to affect most math symbols and letters,
  754. % we have to define the \textfont of the standard families.  Since
  755. % texinfo doesn't allow for producing subscripts and superscripts, we
  756. % don't bother to reset \scriptfont and \scriptscriptfont (which would
  757. % also require loading a lot more fonts).
  758. \def\resetmathfonts{%
  759.   \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
  760.   \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
  761.   \textfont\ttfam = \tentt \textfont\sffam = \tensf
  762. % The font-changing commands redefine the meanings of \tenSTYLE, instead
  763. % of just \STYLE.  We do this so that font changes will continue to work
  764. % in math mode, where it is the current \fam that is relevant in most
  765. % cases, not the current.  Plain TeX does, for example,
  766. % \def\bf{\fam=\bffam \tenbf}  By redefining \tenbf, we obviate the need
  767. % to redefine \bf itself.
  768. \def\textfonts{%
  769.   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  770.   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  771.   \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
  772.   \resetmathfonts}
  773. \def\chapfonts{%
  774.   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
  775.   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  776.   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
  777.   \resetmathfonts}
  778. \def\secfonts{%
  779.   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  780.   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
  781.   \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
  782.   \resetmathfonts}
  783. \def\subsecfonts{%
  784.   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  785.   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  786.   \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
  787.   \resetmathfonts}
  788. \def\indexfonts{%
  789.   \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
  790.   \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
  791.   \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
  792.   \resetmathfonts}
  793. % Set up the default fonts, so we can use them for creating boxes.
  794. \textfonts
  795. % Count depth in font-changes, for error checks
  796. \newcount\fontdepth \fontdepth=0
  797. % Fonts for short table of contents.
  798. \font\shortcontrm=cmr12
  799. \font\shortcontbf=cmbx12
  800. \font\shortcontsl=cmsl12
  801. %% Add scribe-like font environments, plus @l for inline lisp (usually sans
  802. %% serif) and @ii for TeX italic
  803. % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  804. % unless the following character is such as not to need one.
  805. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
  806. \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
  807. \let\i=\smartitalic
  808. \let\var=\smartitalic
  809. \let\dfn=\smartitalic
  810. \let\emph=\smartitalic
  811. \let\cite=\smartitalic
  812. \def\b#1{{\bf #1}}
  813. \let\strong=\b
  814. % We can't just use \exhyphenpenalty, because that only has effect at
  815. % the end of a paragraph.  Restore normal hyphenation at the end of the
  816. % group within which \nohyphenation is presumably called.
  817. \def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
  818. \def\restorehyphenation{\hyphenchar\font = `- }
  819. \def\t#1{%
  820.   {\tt \nohyphenation \rawbackslash \frenchspacing #1}%
  821.   \null
  822. \let\ttfont = \t
  823. %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
  824. \def\samp #1{`\tclose{#1}'\null}
  825. \def\key #1{{\tt \nohyphenation \uppercase{#1}}\null}
  826. \def\ctrl #1{{\tt \rawbackslash \hat}#1}
  827. \let\file=\samp
  828. % @code is a modification of @t,
  829. % which makes spaces the same size as normal in the surrounding text.
  830. \def\tclose#1{%
  831.     % Change normal interword space to be same as for the current font.
  832.     \spaceskip = \fontdimen2\font
  833.     %
  834.     % Switch to typewriter.
  835.     \tt
  836.     %
  837.     % But `\ ' produces the large typewriter interword space.
  838.     \def\ {{\spaceskip = 0pt{} }}%
  839.     %
  840.     % Turn off hyphenation.
  841.     \nohyphenation
  842.     %
  843.     \rawbackslash
  844.     \frenchspacing
  845.     #1%
  846.   \null
  847. % We *must* turn on hyphenation at `-' and `_' in \code.
  848. % Otherwise, it is too hard to avoid overful hboxes
  849. % in the Emacs manual, the Library manual, etc.
  850. % Unfortunately, TeX uses one parameter (\hyphenchar) to control
  851. % both hyphenation at - and hyphenation within words.
  852. % We must therefore turn them both off (\tclose does that)
  853. % and arrange explicitly to hyphenate an a dash.
  854. %  -- rms.
  855. \catcode `\-=\active
  856. \catcode `\_=\active
  857. \global\def\code{\begingroup \catcode `\-=\active \let-\codedash \let_\codeunder \codex}
  858. \def\codedash{-\discretionary{}{}{}}
  859. \def\codeunder{\normalunderscore\discretionary{}{}{}}
  860. \def\codex #1{\tclose{#1}\endgroup}
  861. %\let\exp=\tclose  %Was temporary
  862. % @kbd is like @code, except that if the argument is just one @key command,
  863. % then @kbd has no effect.
  864. \def\xkey{\key}
  865. \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
  866. \ifx\one\xkey\ifx\threex\three \key{#2}%
  867. \else\tclose{\look}\fi
  868. \else\tclose{\look}\fi}
  869. % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
  870. % argument is to make the input look right: @dmn{pt} instead of
  871. % @dmn{}pt.
  872. \def\dmn#1{\thinspace #1}
  873. \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
  874. \def\l#1{{\li #1}\null}        %
  875. \def\r#1{{\rm #1}}        % roman font
  876. % Use of \lowercase was suggested.
  877. \def\sc#1{{\smallcaps#1}}    % smallcaps font
  878. \def\ii#1{{\it #1}}        % italic font
  879. \message{page headings,}
  880. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  881. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  882. % First the title page.  Must do @settitle before @titlepage.
  883. \def\titlefont#1{{\titlerm #1}}
  884. \newif\ifseenauthor
  885. \newif\iffinishedtitlepage
  886. \def\shorttitlepage{\parsearg\shorttitlepagezzz}
  887. \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  888.     \endgroup\page\hbox{}\page}
  889. \def\titlepage{\begingroup \parindent=0pt \textfonts
  890.    \let\subtitlerm=\tenrm
  891. % I deinstalled the following change because \cmr12 is undefined.
  892. % This change was not in the ChangeLog anyway.  --rms.
  893. %   \let\subtitlerm=\cmr12
  894.    \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  895.    \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
  896.    % Leave some space at the very top of the page.
  897.    \vglue\titlepagetopglue
  898.    % Now you can print the title using @title.
  899.    \def\title{\parsearg\titlezzz}%
  900.    \def\titlezzz##1{\leftline{\titlefont{##1}}
  901.             % print a rule at the page bottom also.
  902.             \finishedtitlepagefalse
  903.             \vskip4pt \hrule height 4pt \vskip4pt}%
  904.    % No rule at page bottom unless we print one at the top with @title.
  905.    \finishedtitlepagetrue
  906.    % Now you can put text using @subtitle.
  907.    \def\subtitle{\parsearg\subtitlezzz}%
  908.    \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  909.    % @author should come last, but may come many times.
  910.    \def\author{\parsearg\authorzzz}%
  911.    \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  912.       {\authorfont \leftline{##1}}}%
  913.    % Most title ``pages'' are actually two pages long, with space
  914.    % at the top of the second.  We don't want the ragged left on the second.
  915.    \let\oldpage = \page
  916.    \def\page{%
  917.       \iffinishedtitlepage\else
  918.      \finishtitlepage
  919.       \fi
  920.       \oldpage
  921.       \let\page = \oldpage
  922.       \hbox{}}%
  923. %   \def\page{\oldpage \hbox{}}
  924. \def\Etitlepage{%
  925.    \iffinishedtitlepage\else
  926.       \finishtitlepage
  927.    \fi
  928.    % It is important to do the page break before ending the group,
  929.    % because the headline and footline are only empty inside the group.
  930.    % If we use the new definition of \page, we always get a blank page
  931.    % after the title page, which we certainly don't want.
  932.    \oldpage
  933.    \endgroup
  934.    \HEADINGSon
  935. \def\finishtitlepage{%
  936.    \vskip4pt \hrule height 2pt
  937.    \vskip\titlepagebottomglue
  938.    \finishedtitlepagetrue
  939. %%% Set up page headings and footings.
  940. \let\thispage=\folio
  941. \newtoks \evenheadline    % Token sequence for heading line of even pages
  942. \newtoks \oddheadline     % Token sequence for heading line of odd pages
  943. \newtoks \evenfootline    % Token sequence for footing line of even pages
  944. \newtoks \oddfootline     % Token sequence for footing line of odd pages
  945. % Now make Tex use those variables
  946. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  947.                             \else \the\evenheadline \fi}}
  948. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  949.                             \else \the\evenfootline \fi}\HEADINGShook}
  950. \let\HEADINGShook=\relax
  951. % Commands to set those variables.
  952. % For example, this is what  @headings on  does
  953. % @evenheading @thistitle|@thispage|@thischapter
  954. % @oddheading @thischapter|@thispage|@thistitle
  955. % @evenfooting @thisfile||
  956. % @oddfooting ||@thisfile
  957. \def\evenheading{\parsearg\evenheadingxxx}
  958. \def\oddheading{\parsearg\oddheadingxxx}
  959. \def\everyheading{\parsearg\everyheadingxxx}
  960. \def\evenfooting{\parsearg\evenfootingxxx}
  961. \def\oddfooting{\parsearg\oddfootingxxx}
  962. \def\everyfooting{\parsearg\everyfootingxxx}
  963. {\catcode`\@=0 %
  964. \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  965. \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  966. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  967. \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  968. \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  969. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  970. \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
  971. \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
  972. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  973. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  974. \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  975. \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  976. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  977. \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  978. \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  979. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  980. \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
  981. \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
  982. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  983. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  984. }% unbind the catcode of @.
  985. % @headings double    turns headings on for double-sided printing.
  986. % @headings single    turns headings on for single-sided printing.
  987. % @headings off        turns them off.
  988. % @headings on        same as @headings double, retained for compatibility.
  989. % @headings after    turns on double-sided headings after this page.
  990. % @headings doubleafter    turns on double-sided headings after this page.
  991. % @headings singleafter turns on single-sided headings after this page.
  992. % By default, they are off.
  993. \def\headings #1 {\csname HEADINGS#1\endcsname}
  994. \def\HEADINGSoff{
  995. \global\evenheadline={\hfil} \global\evenfootline={\hfil}
  996. \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  997. \HEADINGSoff
  998. % When we turn headings on, set the page number to 1.
  999. % For double-sided printing, put current file name in lower left corner,
  1000. % chapter name on inside top of right hand pages, document
  1001. % title on inside top of left hand pages, and page numbers on outside top
  1002. % edge of all pages.
  1003. \def\HEADINGSdouble{
  1004. %\pagealignmacro
  1005. \global\pageno=1
  1006. \global\evenfootline={\hfil}
  1007. \global\oddfootline={\hfil}
  1008. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1009. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1010. % For single-sided printing, chapter title goes across top left of page,
  1011. % page number on top right.
  1012. \def\HEADINGSsingle{
  1013. %\pagealignmacro
  1014. \global\pageno=1
  1015. \global\evenfootline={\hfil}
  1016. \global\oddfootline={\hfil}
  1017. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1018. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1019. \def\HEADINGSon{\HEADINGSdouble}
  1020. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  1021. \let\HEADINGSdoubleafter=\HEADINGSafter
  1022. \def\HEADINGSdoublex{%
  1023. \global\evenfootline={\hfil}
  1024. \global\oddfootline={\hfil}
  1025. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1026. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1027. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  1028. \def\HEADINGSsinglex{%
  1029. \global\evenfootline={\hfil}
  1030. \global\oddfootline={\hfil}
  1031. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1032. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1033. % Subroutines used in generating headings
  1034. % Produces Day Month Year style of output.
  1035. \def\today{\number\day\space
  1036. \ifcase\month\or
  1037. January\or February\or March\or April\or May\or June\or
  1038. July\or August\or September\or October\or November\or December\fi
  1039. \space\number\year}
  1040. % Use this if you want the Month Day, Year style of output.
  1041. %\def\today{\ifcase\month\or
  1042. %January\or February\or March\or April\or May\or June\or
  1043. %July\or August\or September\or October\or November\or December\fi
  1044. %\space\number\day, \number\year}
  1045. % @settitle line...  specifies the title of the document, for headings
  1046. % It generates no output of its own
  1047. \def\thistitle{No Title}
  1048. \def\settitle{\parsearg\settitlezzz}
  1049. \def\settitlezzz #1{\gdef\thistitle{#1}}
  1050. \message{tables,}
  1051. % @tabs -- simple alignment
  1052. % These don't work.  For one thing, \+ is defined as outer.
  1053. % So these macros cannot even be defined.
  1054. %\def\tabs{\parsearg\tabszzz}
  1055. %\def\tabszzz #1{\settabs\+#1\cr}
  1056. %\def\tabline{\parsearg\tablinezzz}
  1057. %\def\tablinezzz #1{\+#1\cr}
  1058. %\def\&{&}
  1059. % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
  1060. % default indentation of table text
  1061. \newdimen\tableindent \tableindent=.8in
  1062. % default indentation of @itemize and @enumerate text
  1063. \newdimen\itemindent  \itemindent=.3in
  1064. % margin between end of table item and start of table text.
  1065. \newdimen\itemmargin  \itemmargin=.1in
  1066. % used internally for \itemindent minus \itemmargin
  1067. \newdimen\itemmax
  1068. % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
  1069. % these defs.
  1070. % They also define \itemindex
  1071. % to index the item name in whatever manner is desired (perhaps none).
  1072. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  1073. \def\internalBitemx{\par \parsearg\itemzzz}
  1074. \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  1075. \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
  1076. \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  1077. \def\internalBkitemx{\par \parsearg\kitemzzz}
  1078. \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
  1079.                  \itemzzz {#1}}
  1080. \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
  1081.                  \itemzzz {#1}}
  1082. \def\itemzzz #1{\begingroup %
  1083.   \advance\hsize by -\rightskip
  1084.   \advance\hsize by -\tableindent
  1085.   \setbox0=\hbox{\itemfont{#1}}%
  1086.   \itemindex{#1}%
  1087.   \nobreak % This prevents a break before @itemx.
  1088.   % Be sure we are not still in the middle of a paragraph.
  1089.   {\parskip = 0in
  1090.   \par
  1091.   % If the item text does not fit in the space we have, put it on a line
  1092.   % by itself, and do not allow a page break either before or after that
  1093.   % line.  We do not start a paragraph here because then if the next
  1094.   % command is, e.g., @kindex, the whatsit would get put into the
  1095.   % horizontal list on a line by itself, resulting in extra blank space.
  1096.   \ifdim \wd0>\itemmax
  1097.     \setbox0=\hbox{\hskip \leftskip \hskip -\tableindent \unhbox0}\box0
  1098.     %
  1099.     % We're going to be starting a paragraph, but we don't want the
  1100.     % \parskip glue -- logically it's part of the @item we just started.
  1101.     \nobreak \vskip-\parskip
  1102.     %
  1103.     % Stop a page break at the \parskip glue coming up.  Unfortunately
  1104.     % we can't prevent a possible page break at the following
  1105.     % \baselineskip glue.
  1106.     \nobreak
  1107.   \else
  1108.     % The item text fits into the space.  Start a paragraph, so that the
  1109.     % following text (if any) will end up on the same line.  Since that
  1110.     % text will be indented by \tableindent, we make the item text be in
  1111.     % a zero-width box.
  1112.     \noindent
  1113.     \rlap{\hskip -\tableindent\box0}%
  1114.   \fi
  1115.   \endgroup
  1116. \def\item{\errmessage{@item while not in a table}}
  1117. \def\itemx{\errmessage{@itemx while not in a table}}
  1118. \def\kitem{\errmessage{@kitem while not in a table}}
  1119. \def\kitemx{\errmessage{@kitemx while not in a table}}
  1120. \def\xitem{\errmessage{@xitem while not in a table}}
  1121. \def\xitemx{\errmessage{@xitemx while not in a table}}
  1122. %% Contains a kludge to get @end[description] to work
  1123. \def\description{\tablez{\dontindex}{1}{}{}{}{}}
  1124. \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  1125. {\obeylines\obeyspaces%
  1126. \gdef\tablex #1^^M{%
  1127. \tabley\dontindex#1        \endtabley}}
  1128. \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  1129. {\obeylines\obeyspaces%
  1130. \gdef\ftablex #1^^M{%
  1131. \tabley\fnitemindex#1        \endtabley
  1132. \def\Eftable{\endgraf\afterenvbreak\endgroup}%
  1133. \let\Etable=\relax}}
  1134. \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
  1135. {\obeylines\obeyspaces%
  1136. \gdef\vtablex #1^^M{%
  1137. \tabley\vritemindex#1        \endtabley
  1138. \def\Evtable{\endgraf\afterenvbreak\endgroup}%
  1139. \let\Etable=\relax}}
  1140. \def\dontindex #1{}
  1141. \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  1142. \def\vritemindex #1{\doind {vr}{\code{#1}}}%
  1143. {\obeyspaces %
  1144. \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  1145. \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  1146. \def\tablez #1#2#3#4#5#6{%
  1147. \aboveenvbreak %
  1148. \begingroup %
  1149. \def\Edescription{\Etable}% Neccessary kludge.
  1150. \let\itemindex=#1%
  1151. \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  1152. \ifnum 0#4>0 \tableindent=#4\mil \fi %
  1153. \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  1154. \def\itemfont{#2}%
  1155. \itemmax=\tableindent %
  1156. \advance \itemmax by -\itemmargin %
  1157. \advance \leftskip by \tableindent %
  1158. \exdentamount=\tableindent
  1159. \parindent = 0pt
  1160. \parskip = \smallskipamount
  1161. \ifdim \parskip=0pt \parskip=2pt \fi%
  1162. \def\Etable{\endgraf\afterenvbreak\endgroup}%
  1163. \let\item = \internalBitem %
  1164. \let\itemx = \internalBitemx %
  1165. \let\kitem = \internalBkitem %
  1166. \let\kitemx = \internalBkitemx %
  1167. \let\xitem = \internalBxitem %
  1168. \let\xitemx = \internalBxitemx %
  1169. % This is the counter used by @enumerate, which is really @itemize
  1170. \newcount \itemno
  1171. \def\itemize{\parsearg\itemizezzz}
  1172. \def\itemizezzz #1{%
  1173.   \begingroup % ended by the @end itemsize
  1174.   \itemizey {#1}{\Eitemize}
  1175. \def\itemizey #1#2{%
  1176. \aboveenvbreak %
  1177. \itemmax=\itemindent %
  1178. \advance \itemmax by -\itemmargin %
  1179. \advance \leftskip by \itemindent %
  1180. \exdentamount=\itemindent
  1181. \parindent = 0pt %
  1182. \parskip = \smallskipamount %
  1183. \ifdim \parskip=0pt \parskip=2pt \fi%
  1184. \def#2{\endgraf\afterenvbreak\endgroup}%
  1185. \def\itemcontents{#1}%
  1186. \let\item=\itemizeitem}
  1187. % Set sfcode to normal for the chars that usually have another value.
  1188. % These are `.?!:;,'
  1189. \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
  1190.   \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
  1191. % \splitoff TOKENS\endmark defines \first to be the first token in
  1192. % TOKENS, and \rest to be the remainder.
  1193. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  1194. % Allow an optional argument of an uppercase letter, lowercase letter,
  1195. % or number, to specify the first label in the enumerated list.  No
  1196. % argument is the same as `1'.
  1197. \def\enumerate{\parsearg\enumeratezzz}
  1198. \def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
  1199. \def\enumeratey #1 #2\endenumeratey{%
  1200.   \begingroup % ended by the @end enumerate
  1201.   % If we were given no argument, pretend we were given `1'.
  1202.   \def\thearg{#1}%
  1203.   \ifx\thearg\empty \def\thearg{1}\fi
  1204.   % Detect if the argument is a single token.  If so, it might be a
  1205.   % letter.  Otherwise, the only valid thing it can be is a number.
  1206.   % (We will always have one token, because of the test we just made.
  1207.   % This is a good thing, since \splitoff doesn't work given nothing at
  1208.   % all -- the first parameter is undelimited.)
  1209.   \expandafter\splitoff\thearg\endmark
  1210.   \ifx\rest\empty
  1211.     % Only one token in the argument.  It could still be anything.
  1212.     % A ``lowercase letter'' is one whose \lccode is nonzero.
  1213.     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  1214.     %   not equal to itself.
  1215.     % Otherwise, we assume it's a number.
  1216.     %
  1217.     % We need the \relax at the end of the \ifnum lines to stop TeX from
  1218.     % continuing to look for a <number>.
  1219.     %
  1220.     \ifnum\lccode\expandafter`\thearg=0\relax
  1221.       \numericenumerate % a number (we hope)
  1222.     \else
  1223.       % It's a letter.
  1224.       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  1225.         \lowercaseenumerate % lowercase letter
  1226.       \else
  1227.         \uppercaseenumerate % uppercase letter
  1228.       \fi
  1229.     \fi
  1230.   \else
  1231.     % Multiple tokens in the argument.  We hope it's a number.
  1232.     \numericenumerate
  1233.   \fi
  1234. % An @enumerate whose labels are integers.  The starting integer is
  1235. % given in \thearg.
  1236. \def\numericenumerate{%
  1237.   \itemno = \thearg
  1238.   \startenumeration{\the\itemno}%
  1239. % The starting (lowercase) letter is in \thearg.
  1240. \def\lowercaseenumerate{%
  1241.   \itemno = \expandafter`\thearg
  1242.   \startenumeration{%
  1243.     % Be sure we're not beyond the end of the alphabet.
  1244.     \ifnum\itemno=0
  1245.       \errmessage{No more lowercase letters in @enumerate; get a bigger
  1246.                   alphabet}%
  1247.     \fi
  1248.     \char\lccode\itemno
  1249. % The starting (uppercase) letter is in \thearg.
  1250. \def\uppercaseenumerate{%
  1251.   \itemno = \expandafter`\thearg
  1252.   \startenumeration{%
  1253.     % Be sure we're not beyond the end of the alphabet.
  1254.     \ifnum\itemno=0
  1255.       \errmessage{No more uppercase letters in @enumerate; get a bigger
  1256.                   alphabet}
  1257.     \fi
  1258.     \char\uccode\itemno
  1259. % Call itemizey, adding a period to the first argument and supplying the
  1260. % common last two arguments.  Also subtract one from the initial value in
  1261. % \itemno, since @item increments \itemno.
  1262. \def\startenumeration#1{%
  1263.   \advance\itemno by -1
  1264.   \itemizey{#1.}\Eenumerate\flushcr
  1265. % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  1266. % to @enumerate.
  1267. \def\alphaenumerate{\enumerate{a}}
  1268. \def\capsenumerate{\enumerate{A}}
  1269. \def\Ealphaenumerate{\Eenumerate}
  1270. \def\Ecapsenumerate{\Eenumerate}
  1271. % Definition of @item while inside @itemize.
  1272. \def\itemizeitem{%
  1273. \advance\itemno by 1
  1274. {\let\par=\endgraf \smallbreak}%
  1275. \ifhmode \errmessage{\in hmode at itemizeitem}\fi
  1276. {\parskip=0in \hskip 0pt
  1277. \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  1278. \vadjust{\penalty 1200}}%
  1279. \flushcr}
  1280. \message{indexing,}
  1281. % Index generation facilities
  1282. % Define \newwrite to be identical to plain tex's \newwrite
  1283. % except not \outer, so it can be used within \newindex.
  1284. {\catcode`\@=11
  1285. \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  1286. % \newindex {foo} defines an index named foo.
  1287. % It automatically defines \fooindex such that
  1288. % \fooindex ...rest of line... puts an entry in the index foo.
  1289. % It also defines \fooindfile to be the number of the output channel for
  1290. % the file that    accumulates this index.  The file's extension is foo.
  1291. % The name of an index should be no more than 2 characters long
  1292. % for the sake of vms.
  1293. \def\newindex #1{
  1294. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1295. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1296. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1297. \noexpand\doindex {#1}}
  1298. % @defindex foo  ==  \newindex{foo}
  1299. \def\defindex{\parsearg\newindex}
  1300. % Define @defcodeindex, like @defindex except put all entries in @code.
  1301. \def\newcodeindex #1{
  1302. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1303. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1304. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1305. \noexpand\docodeindex {#1}}
  1306. \def\defcodeindex{\parsearg\newcodeindex}
  1307. % @synindex foo bar    makes index foo feed into index bar.
  1308. % Do this instead of @defindex foo if you don't want it as a separate index.
  1309. \def\synindex #1 #2 {%
  1310. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1311. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1312. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1313. \noexpand\doindex {#2}}%
  1314. % @syncodeindex foo bar   similar, but put all entries made for index foo
  1315. % inside @code.
  1316. \def\syncodeindex #1 #2 {%
  1317. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1318. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1319. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1320. \noexpand\docodeindex {#2}}%
  1321. % Define \doindex, the driver for all \fooindex macros.
  1322. % Argument #1 is generated by the calling \fooindex macro,
  1323. %  and it is "foo", the name of the index.
  1324. % \doindex just uses \parsearg; it calls \doind for the actual work.
  1325. % This is because \doind is more useful to call from other macros.
  1326. % There is also \dosubind {index}{topic}{subtopic}
  1327. % which makes an entry in a two-level index such as the operation index.
  1328. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  1329. \def\singleindexer #1{\doind{\indexname}{#1}}
  1330. % like the previous two, but they put @code around the argument.
  1331. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  1332. \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  1333. \def\indexdummies{%
  1334. \def\_{{\realbackslash _}}%
  1335. \def\w{\realbackslash w }%
  1336. \def\bf{\realbackslash bf }%
  1337. \def\rm{\realbackslash rm }%
  1338. \def\sl{\realbackslash sl }%
  1339. \def\sf{\realbackslash sf}%
  1340. \def\tt{\realbackslash tt}%
  1341. \def\gtr{\realbackslash gtr}%
  1342. \def\less{\realbackslash less}%
  1343. \def\hat{\realbackslash hat}%
  1344. \def\char{\realbackslash char}%
  1345. \def\TeX{\realbackslash TeX}%
  1346. \def\dots{\realbackslash dots }%
  1347. \def\copyright{\realbackslash copyright }%
  1348. \def\tclose##1{\realbackslash tclose {##1}}%
  1349. \def\code##1{\realbackslash code {##1}}%
  1350. \def\samp##1{\realbackslash samp {##1}}%
  1351. \def\t##1{\realbackslash r {##1}}%
  1352. \def\r##1{\realbackslash r {##1}}%
  1353. \def\i##1{\realbackslash i {##1}}%
  1354. \def\b##1{\realbackslash b {##1}}%
  1355. \def\cite##1{\realbackslash cite {##1}}%
  1356. \def\key##1{\realbackslash key {##1}}%
  1357. \def\file##1{\realbackslash file {##1}}%
  1358. \def\var##1{\realbackslash var {##1}}%
  1359. \def\kbd##1{\realbackslash kbd {##1}}%
  1360. \def\dfn##1{\realbackslash dfn {##1}}%
  1361. \def\emph##1{\realbackslash emph {##1}}%
  1362. % \indexnofonts no-ops all font-change commands.
  1363. % This is used when outputting the strings to sort the index by.
  1364. \def\indexdummyfont#1{#1}
  1365. \def\indexdummytex{TeX}
  1366. \def\indexdummydots{...}
  1367. \def\indexnofonts{%
  1368. \let\w=\indexdummyfont
  1369. \let\t=\indexdummyfont
  1370. \let\r=\indexdummyfont
  1371. \let\i=\indexdummyfont
  1372. \let\b=\indexdummyfont
  1373. \let\emph=\indexdummyfont
  1374. \let\strong=\indexdummyfont
  1375. \let\cite=\indexdummyfont
  1376. \let\sc=\indexdummyfont
  1377. %Don't no-op \tt, since it isn't a user-level command
  1378. % and is used in the definitions of the active chars like <, >, |...
  1379. %\let\tt=\indexdummyfont
  1380. \let\tclose=\indexdummyfont
  1381. \let\code=\indexdummyfont
  1382. \let\file=\indexdummyfont
  1383. \let\samp=\indexdummyfont
  1384. \let\kbd=\indexdummyfont
  1385. \let\key=\indexdummyfont
  1386. \let\var=\indexdummyfont
  1387. \let\TeX=\indexdummytex
  1388. \let\dots=\indexdummydots
  1389. % To define \realbackslash, we must make \ not be an escape.
  1390. % We must first make another character (@) an escape
  1391. % so we do not become unable to do a definition.
  1392. {\catcode`\@=0 \catcode`\\=\other
  1393. @gdef@realbackslash{\}}
  1394. \let\indexbackslash=0  %overridden during \printindex.
  1395. \def\doind #1#2{%
  1396. {\count10=\lastpenalty %
  1397. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1398. \escapechar=`\\%
  1399. {\let\folio=0% Expand all macros now EXCEPT \folio
  1400. \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  1401. % so it will be output as is; and it will print as backslash in the indx.
  1402. % Now process the index-string once, with all font commands turned off,
  1403. % to get the string to sort the index by.
  1404. {\indexnofonts
  1405. \xdef\temp1{#2}%
  1406. % Now produce the complete index entry.  We process the index-string again,
  1407. % this time with font commands expanded, to get what to print in the index.
  1408. \edef\temp{%
  1409. \write \csname#1indfile\endcsname{%
  1410. \realbackslash entry {\temp1}{\folio}{#2}}}%
  1411. \temp }%
  1412. }\penalty\count10}}
  1413. \def\dosubind #1#2#3{%
  1414. {\count10=\lastpenalty %
  1415. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1416. \escapechar=`\\%
  1417. {\let\folio=0%
  1418. \def\rawbackslashxx{\indexbackslash}%
  1419. % Now process the index-string once, with all font commands turned off,
  1420. % to get the string to sort the index by.
  1421. {\indexnofonts
  1422. \xdef\temp1{#2 #3}%
  1423. % Now produce the complete index entry.  We process the index-string again,
  1424. % this time with font commands expanded, to get what to print in the index.
  1425. \edef\temp{%
  1426. \write \csname#1indfile\endcsname{%
  1427. \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
  1428. \temp }%
  1429. }\penalty\count10}}
  1430. % The index entry written in the file actually looks like
  1431. %  \entry {sortstring}{page}{topic}
  1432. %  \entry {sortstring}{page}{topic}{subtopic}
  1433. % The texindex program reads in these files and writes files
  1434. % containing these kinds of lines:
  1435. %  \initial {c}
  1436. %     before the first topic whose initial is c
  1437. %  \entry {topic}{pagelist}
  1438. %     for a topic that is used without subtopics
  1439. %  \primary {topic}
  1440. %     for the beginning of a topic that is used with subtopics
  1441. %  \secondary {subtopic}{pagelist}
  1442. %     for each subtopic.
  1443. % Define the user-accessible indexing commands
  1444. % @findex, @vindex, @kindex, @cindex.
  1445. \def\findex {\fnindex}
  1446. \def\kindex {\kyindex}
  1447. \def\cindex {\cpindex}
  1448. \def\vindex {\vrindex}
  1449. \def\tindex {\tpindex}
  1450. \def\pindex {\pgindex}
  1451. \def\cindexsub {\begingroup\obeylines\cindexsub}
  1452. {\obeylines %
  1453. \gdef\cindexsub "#1" #2^^M{\endgroup %
  1454. \dosubind{cp}{#2}{#1}}}
  1455. % Define the macros used in formatting output of the sorted index material.
  1456. % This is what you call to cause a particular index to get printed.
  1457. % Write
  1458. % @unnumbered Function Index
  1459. % @printindex fn
  1460. \def\printindex{\parsearg\doprintindex}
  1461. \def\doprintindex#1{%
  1462.   \tex
  1463.   \dobreak \chapheadingskip {10000}
  1464.   \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
  1465.   \catcode`\$=\other\catcode`\_=\other
  1466.   \catcode`\~=\other
  1467.   % The following don't help, since the chars were translated
  1468.   % when the raw index was written, and their fonts were discarded
  1469.   % due to \indexnofonts.
  1470.   %\catcode`\"=\active
  1471.   %\catcode`\^=\active
  1472.   %\catcode`\_=\active
  1473.   %\catcode`\|=\active
  1474.   %\catcode`\<=\active
  1475.   %\catcode`\>=\active
  1476.   % %
  1477.   \def\indexbackslash{\rawbackslashxx}
  1478.   \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
  1479.   \begindoublecolumns
  1480.   % See if the index file exists and is nonempty.
  1481.   \openin 1 \jobname.#1s
  1482.   \ifeof 1
  1483.     % \enddoublecolumns gets confused if there is no text in the index,
  1484.     % and it loses the chapter title and the aux file entries for the
  1485.     % index.  The easiest way to prevent this problem is to make sure
  1486.     % there is some text.
  1487.     (Index is nonexistent)
  1488.     \else
  1489.     %
  1490.     % If the index file exists but is empty, then \openin leaves \ifeof
  1491.     % false.  We have to make TeX try to read something from the file, so
  1492.     % it can discover if there is anything in it.
  1493.     \read 1 to \temp
  1494.     \ifeof 1
  1495.       (Index is empty)
  1496.     \else
  1497.       \input \jobname.#1s
  1498.     \fi
  1499.   \fi
  1500.   \closein 1
  1501.   \enddoublecolumns
  1502.   \Etex
  1503. % These macros are used by the sorted index file itself.
  1504. % Change them to control the appearance of the index.
  1505. % Same as \bigskipamount except no shrink.
  1506. % \balancecolumns gets confused if there is any shrink.
  1507. \newskip\initialskipamount \initialskipamount 12pt plus4pt
  1508. \def\initial #1{%
  1509. {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  1510. \ifdim\lastskip<\initialskipamount
  1511. \removelastskip \penalty-200 \vskip \initialskipamount\fi
  1512. \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
  1513. % This typesets a paragraph consisting of #1, dot leaders, and then #2
  1514. % flush to the right margin.  It is used for index and table of contents
  1515. % entries.  The paragraph is indented by \leftskip.
  1516. \def\entry #1#2{\begingroup
  1517.   % Start a new paragraph if necessary, so our assignments below can't
  1518.   % affect previous text.
  1519.   \par
  1520.   % Do not fill out the last line with white space.
  1521.   \parfillskip = 0in
  1522.   % No extra space above this paragraph.
  1523.   \parskip = 0in
  1524.   % Do not prefer a separate line ending with a hyphen to fewer lines.
  1525.   \finalhyphendemerits = 0
  1526.   % \hangindent is only relevant when the entry text and page number
  1527.   % don't both fit on one line.  In that case, bob suggests starting the
  1528.   % dots pretty far over on the line.  Unfortunately, a large
  1529.   % indentation looks wrong when the entry text itself is broken across
  1530.   % lines.  So we use a small indentation and put up with long leaders.
  1531.   % \hangafter is reset to 1 (which is the value we want) at the start
  1532.   % of each paragraph, so we need not do anything with that.
  1533.   \hangindent=2em
  1534.   % When the entry text needs to be broken, just fill out the first line
  1535.   % with blank space.
  1536.   \rightskip = 0pt plus1fil
  1537.   % Start a ``paragraph'' for the index entry so the line breaking
  1538.   % parameters we've set above will have an effect.
  1539.   \noindent
  1540.   % Insert the text of the index entry.  TeX will do line-breaking on it.
  1541.   #1%
  1542.   % If we must, put the page number on a line of its own, and fill out
  1543.   % this line with blank space.  (The \hfil is overwhelmed with the
  1544.   % fill leaders glue in \indexdotfill if the page number does fit.)
  1545.   \hfil\penalty50
  1546.   \null\nobreak\indexdotfill % Have leaders before the page number.
  1547.   % The `\ ' here is removed by the implicit \unskip that TeX does as
  1548.   % part of (the primitive) \par.  Without it, a spurious underfull
  1549.   % \hbox ensues.
  1550.   \ #2% The page number ends the paragraph.
  1551.   \par
  1552. \endgroup}
  1553. % Like \dotfill except takes at least 1 em.
  1554. \def\indexdotfill{\cleaders
  1555.   \hbox{$\mathsurround=0pt \mkern1.5mu . \mkern1.5mu$}\hskip 1em plus 1fill}
  1556. \def\primary #1{\line{#1\hfil}}
  1557. \newskip\secondaryindent \secondaryindent=0.5cm
  1558. \def\secondary #1#2{
  1559. {\parfillskip=0in \parskip=0in
  1560. \hangindent =1in \hangafter=1
  1561. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
  1562. %% Define two-column mode, which is used in indexes.
  1563. %% Adapted from the TeXbook, page 416.
  1564. \catcode `\@=11
  1565. \newbox\partialpage
  1566. \newdimen\doublecolumnhsize
  1567. \def\begindoublecolumns{\begingroup
  1568.   % Grab any single-column material above us.
  1569.   \output = {\global\setbox\partialpage
  1570.     =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
  1571.   \eject
  1572.   % Now switch to the double-column output routine.
  1573.   \output={\doublecolumnout}%
  1574.   % Change the page size parameters.  We could do this once outside this
  1575.   % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  1576.   % format, but then we repeat the same computation.  Repeating a couple
  1577.   % of assignments once per index is clearly meaningless for the
  1578.   % execution time, so we may as well do it once.
  1579.   % First we halve the line length, less a little for the gutter between
  1580.   % the columns.  We compute the gutter based on the line length, so it
  1581.   % changes automatically with the paper format.  The magic constant
  1582.   % below is chosen so that the gutter has the same value (well, +- <
  1583.   % 1pt) as it did when we hard-coded it.
  1584.   % We put the result in a separate register, \doublecolumhsize, so we
  1585.   % can restore it in \pagesofar, after \hsize itself has (potentially)
  1586.   % been clobbered.
  1587.   \doublecolumnhsize = \hsize
  1588.     \advance\doublecolumnhsize by -.04154\hsize
  1589.     \divide\doublecolumnhsize by 2
  1590.   \hsize = \doublecolumnhsize
  1591.   % Double the \vsize as well.  (We don't need a separate register here,
  1592.   % since nobody clobbers \vsize.)
  1593.   \vsize = 2\vsize
  1594.   \doublecolumnpagegoal
  1595. \def\enddoublecolumns{\eject \endgroup \pagegoal=\vsize \unvbox\partialpage}
  1596. \def\doublecolumnsplit{\splittopskip=\topskip \splitmaxdepth=\maxdepth
  1597.   \global\dimen@=\pageheight \global\advance\dimen@ by-\ht\partialpage
  1598.   \global\setbox1=\vsplit255 to\dimen@ \global\setbox0=\vbox{\unvbox1}
  1599.   \global\setbox3=\vsplit255 to\dimen@ \global\setbox2=\vbox{\unvbox3}
  1600.   \ifdim\ht0>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
  1601.   \ifdim\ht2>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
  1602. \def\doublecolumnpagegoal{%
  1603.   \dimen@=\vsize \advance\dimen@ by-2\ht\partialpage \global\pagegoal=\dimen@
  1604. \def\pagesofar{\unvbox\partialpage %
  1605.   \hsize=\doublecolumnhsize % have to restore this since output routine
  1606.   \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
  1607. \def\doublecolumnout{%
  1608.   \setbox5=\copy255
  1609.   {\vbadness=10000 \doublecolumnsplit}
  1610.   \ifvbox255
  1611.     \setbox0=\vtop to\dimen@{\unvbox0}
  1612.     \setbox2=\vtop to\dimen@{\unvbox2}
  1613.     \onepageout\pagesofar \unvbox255 \penalty\outputpenalty
  1614.   \else
  1615.     \setbox0=\vbox{\unvbox5}
  1616.     \ifvbox0
  1617.       \dimen@=\ht0 \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1618.       \divide\dimen@ by2 \splittopskip=\topskip \splitmaxdepth=\maxdepth
  1619.       {\vbadness=10000
  1620.     \loop \global\setbox5=\copy0
  1621.           \setbox1=\vsplit5 to\dimen@
  1622.           \setbox3=\vsplit5 to\dimen@
  1623.           \ifvbox5 \global\advance\dimen@ by1pt \repeat
  1624.         \setbox0=\vbox to\dimen@{\unvbox1}
  1625.         \setbox2=\vbox to\dimen@{\unvbox3}
  1626.         \global\setbox\partialpage=\vbox{\pagesofar}
  1627.         \doublecolumnpagegoal
  1628.       }
  1629.     \fi
  1630.   \fi
  1631. \catcode `\@=\other
  1632. \message{sectioning,}
  1633. % Define chapters, sections, etc.
  1634. \newcount \chapno
  1635. \newcount \secno        \secno=0
  1636. \newcount \subsecno     \subsecno=0
  1637. \newcount \subsubsecno  \subsubsecno=0
  1638. % This counter is funny since it counts through charcodes of letters A, B, ...
  1639. \newcount \appendixno  \appendixno = `\@
  1640. \def\appendixletter{\char\the\appendixno}
  1641. \newwrite \contentsfile
  1642. % This is called from \setfilename.
  1643. \def\opencontents{\openout \contentsfile = \jobname.toc}
  1644. % Each @chapter defines this as the name of the chapter.
  1645. % page headings and footings can use it.  @section does likewise
  1646. \def\thischapter{} \def\thissection{}
  1647. \def\seccheck#1{\if \pageno<0 %
  1648. \errmessage{@#1 not allowed after generating table of contents}\fi
  1649. \def\chapternofonts{%
  1650. \let\rawbackslash=\relax%
  1651. \let\frenchspacing=\relax%
  1652. \def\result{\realbackslash result}
  1653. \def\equiv{\realbackslash equiv}
  1654. \def\expansion{\realbackslash expansion}
  1655. \def\print{\realbackslash print}
  1656. \def\TeX{\realbackslash TeX}
  1657. \def\dots{\realbackslash dots}
  1658. \def\copyright{\realbackslash copyright}
  1659. \def\tt{\realbackslash tt}
  1660. \def\bf{\realbackslash bf }
  1661. \def\w{\realbackslash w}
  1662. \def\less{\realbackslash less}
  1663. \def\gtr{\realbackslash gtr}
  1664. \def\hat{\realbackslash hat}
  1665. \def\char{\realbackslash char}
  1666. \def\tclose##1{\realbackslash tclose {##1}}
  1667. \def\code##1{\realbackslash code {##1}}
  1668. \def\samp##1{\realbackslash samp {##1}}
  1669. \def\r##1{\realbackslash r {##1}}
  1670. \def\b##1{\realbackslash b {##1}}
  1671. \def\key##1{\realbackslash key {##1}}
  1672. \def\file##1{\realbackslash file {##1}}
  1673. \def\kbd##1{\realbackslash kbd {##1}}
  1674. % These are redefined because @smartitalic wouldn't work inside xdef.
  1675. \def\i##1{\realbackslash i {##1}}
  1676. \def\cite##1{\realbackslash cite {##1}}
  1677. \def\var##1{\realbackslash var {##1}}
  1678. \def\emph##1{\realbackslash emph {##1}}
  1679. \def\dfn##1{\realbackslash dfn {##1}}
  1680. \newcount\absseclevel % used to calculate proper heading level
  1681. \newcount\secbase\secbase=0 % @raise/lowersections modify this count
  1682. % @raisesections: treat @section as chapter, @subsection as section, etc.
  1683. \def\raisesections{\global\advance\secbase by -1}
  1684. \let\up=\raisesections % original BFox name
  1685. % @lowersections: treat @chapter as section, @section as subsection, etc.
  1686. \def\lowersections{\global\advance\secbase by 1}
  1687. \let\down=\lowersections % original BFox name
  1688. % Choose a numbered-heading macro
  1689. % #1 is heading level if unmodified by @raisesections or @lowersections
  1690. % #2 is text for heading
  1691. \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1692. \ifcase\absseclevel
  1693.   \chapterzzz{#2}
  1694.   \seczzz{#2}
  1695.   \numberedsubseczzz{#2}
  1696.   \numberedsubsubseczzz{#2}
  1697. \else
  1698.   \ifnum \absseclevel<0
  1699.     \chapterzzz{#2}
  1700.   \else
  1701.     \numberedsubsubseczzz{#2}
  1702.   \fi
  1703. % like \numhead, but chooses appendix heading levels
  1704. \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1705. \ifcase\absseclevel
  1706.   \appendixzzz{#2}
  1707.   \appendixsectionzzz{#2}
  1708.   \appendixsubseczzz{#2}
  1709.   \appendixsubsubseczzz{#2}
  1710. \else
  1711.   \ifnum \absseclevel<0
  1712.     \appendixzzz{#2}
  1713.   \else
  1714.     \appendixsubsubseczzz{#2}
  1715.   \fi
  1716. % like \numhead, but chooses numberless heading levels
  1717. \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1718. \ifcase\absseclevel
  1719.   \unnumberedzzz{#2}
  1720.   \unnumberedseczzz{#2}
  1721.   \unnumberedsubseczzz{#2}
  1722.   \unnumberedsubsubseczzz{#2}
  1723. \else
  1724.   \ifnum \absseclevel<0
  1725.     \unnumberedzzz{#2}
  1726.   \else
  1727.     \unnumberedsubsubseczzz{#2}
  1728.   \fi
  1729. \def\thischaptername{No Chapter Title}
  1730. \outer\def\chapter{\parsearg\chapteryyy}
  1731. \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
  1732. \def\chapterzzz #1{\seccheck{chapter}%
  1733. \secno=0 \subsecno=0 \subsubsecno=0
  1734. \global\advance \chapno by 1 \message{Chapter \the\chapno}%
  1735. \chapmacro {#1}{\the\chapno}%
  1736. \gdef\thissection{#1}%
  1737. \gdef\thischaptername{#1}%
  1738. % We don't substitute the actual chapter name into \thischapter
  1739. % because we don't want its macros evaluated now.
  1740. \xdef\thischapter{Chapter \the\chapno: \noexpand\thischaptername}%
  1741. {\chapternofonts%
  1742. \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
  1743. \escapechar=`\\%
  1744. \write \contentsfile \temp  %
  1745. \donoderef %
  1746. \global\let\section = \numberedsec
  1747. \global\let\subsection = \numberedsubsec
  1748. \global\let\subsubsection = \numberedsubsubsec
  1749. \outer\def\appendix{\parsearg\appendixyyy}
  1750. \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
  1751. \def\appendixzzz #1{\seccheck{appendix}%
  1752. \secno=0 \subsecno=0 \subsubsecno=0
  1753. \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
  1754. \chapmacro {#1}{Appendix \appendixletter}%
  1755. \gdef\thissection{#1}%
  1756. \gdef\thischaptername{#1}%
  1757. \xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}%
  1758. {\chapternofonts%
  1759. \edef\temp{{\realbackslash chapentry
  1760.   {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
  1761. \escapechar=`\\%
  1762. \write \contentsfile \temp  %
  1763. \appendixnoderef %
  1764. \global\let\section = \appendixsec
  1765. \global\let\subsection = \appendixsubsec
  1766. \global\let\subsubsection = \appendixsubsubsec
  1767. \outer\def\top{\parsearg\unnumberedyyy}
  1768. \outer\def\unnumbered{\parsearg\unnumberedyyy}
  1769. \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
  1770. \def\unnumberedzzz #1{\seccheck{unnumbered}%
  1771. \secno=0 \subsecno=0 \subsubsecno=0
  1772. % This used to be simply \message{#1}, but TeX fully expands the
  1773. % argument to \message.  Therefore, if #1 contained @-commands, TeX
  1774. % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
  1775. % expanded @cite (which turns out to cause errors because \cite is meant
  1776. % to be executed, not expanded).
  1777. % Anyway, we don't want the fully-expanded definition of @cite to appear
  1778. % as a result of the \message, we just want `@cite' itself.  We use
  1779. % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  1780. % simply yielding the contents of the <toks register>.
  1781. \toks0 = {#1}\message{(\the\toks0)}%
  1782. \unnumbchapmacro {#1}%
  1783. \gdef\thischapter{#1}\gdef\thissection{#1}%
  1784. {\chapternofonts%
  1785. \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
  1786. \escapechar=`\\%
  1787. \write \contentsfile \temp  %
  1788. \unnumbnoderef %
  1789. \global\let\section = \unnumberedsec
  1790. \global\let\subsection = \unnumberedsubsec
  1791. \global\let\subsubsection = \unnumberedsubsubsec
  1792. \outer\def\numberedsec{\parsearg\secyyy}
  1793. \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
  1794. \def\seczzz #1{\seccheck{section}%
  1795. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1796. \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  1797. {\chapternofonts%
  1798. \edef\temp{{\realbackslash secentry %
  1799. {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
  1800. \escapechar=`\\%
  1801. \write \contentsfile \temp %
  1802. \donoderef %
  1803. \penalty 10000 %
  1804. \outer\def\appenixsection{\parsearg\appendixsecyyy}
  1805. \outer\def\appendixsec{\parsearg\appendixsecyyy}
  1806. \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
  1807. \def\appendixsectionzzz #1{\seccheck{appendixsection}%
  1808. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1809. \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  1810. {\chapternofonts%
  1811. \edef\temp{{\realbackslash secentry %
  1812. {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
  1813. \escapechar=`\\%
  1814. \write \contentsfile \temp %
  1815. \appendixnoderef %
  1816. \penalty 10000 %
  1817. \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
  1818. \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
  1819. \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
  1820. \plainsecheading {#1}\gdef\thissection{#1}%
  1821. {\chapternofonts%
  1822. \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
  1823. \escapechar=`\\%
  1824. \write \contentsfile \temp %
  1825. \unnumbnoderef %
  1826. \penalty 10000 %
  1827. \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
  1828. \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
  1829. \def\numberedsubseczzz #1{\seccheck{subsection}%
  1830. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1831. \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  1832. {\chapternofonts%
  1833. \edef\temp{{\realbackslash subsecentry %
  1834. {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1835. \escapechar=`\\%
  1836. \write \contentsfile \temp %
  1837. \donoderef %
  1838. \penalty 10000 %
  1839. \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
  1840. \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
  1841. \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
  1842. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1843. \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  1844. {\chapternofonts%
  1845. \edef\temp{{\realbackslash subsecentry %
  1846. {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1847. \escapechar=`\\%
  1848. \write \contentsfile \temp %
  1849. \appendixnoderef %
  1850. \penalty 10000 %
  1851. \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
  1852. \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
  1853. \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
  1854. \plainsecheading {#1}\gdef\thissection{#1}%
  1855. {\chapternofonts%
  1856. \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
  1857. \escapechar=`\\%
  1858. \write \contentsfile \temp %
  1859. \unnumbnoderef %
  1860. \penalty 10000 %
  1861. \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
  1862. \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
  1863. \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
  1864. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1865. \subsubsecheading {#1}
  1866.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1867. {\chapternofonts%
  1868. \edef\temp{{\realbackslash subsubsecentry %
  1869.   {#1}
  1870.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
  1871.   {\noexpand\folio}}}%
  1872. \escapechar=`\\%
  1873. \write \contentsfile \temp %
  1874. \donoderef %
  1875. \penalty 10000 %
  1876. \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
  1877. \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
  1878. \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
  1879. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1880. \subsubsecheading {#1}
  1881.   {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1882. {\chapternofonts%
  1883. \edef\temp{{\realbackslash subsubsecentry{#1}%
  1884.   {\appendixletter}
  1885.   {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
  1886. \escapechar=`\\%
  1887. \write \contentsfile \temp %
  1888. \appendixnoderef %
  1889. \penalty 10000 %
  1890. \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
  1891. \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
  1892. \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
  1893. \plainsecheading {#1}\gdef\thissection{#1}%
  1894. {\chapternofonts%
  1895. \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
  1896. \escapechar=`\\%
  1897. \write \contentsfile \temp %
  1898. \unnumbnoderef %
  1899. \penalty 10000 %
  1900. % These are variants which are not "outer", so they can appear in @ifinfo.
  1901. % Actually, they should now be obsolete; ordinary section commands should work.
  1902. \def\infotop{\parsearg\unnumberedzzz}
  1903. \def\infounnumbered{\parsearg\unnumberedzzz}
  1904. \def\infounnumberedsec{\parsearg\unnumberedseczzz}
  1905. \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1906. \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1907. \def\infoappendix{\parsearg\appendixzzz}
  1908. \def\infoappendixsec{\parsearg\appendixseczzz}
  1909. \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  1910. \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1911. \def\infochapter{\parsearg\chapterzzz}
  1912. \def\infosection{\parsearg\sectionzzz}
  1913. \def\infosubsection{\parsearg\subsectionzzz}
  1914. \def\infosubsubsection{\parsearg\subsubsectionzzz}
  1915. % These macros control what the section commands do, according
  1916. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  1917. % Define them by default for a numbered chapter.
  1918. \global\let\section = \numberedsec
  1919. \global\let\subsection = \numberedsubsec
  1920. \global\let\subsubsection = \numberedsubsubsec
  1921. % Define @majorheading, @heading and @subheading
  1922. % NOTE on use of \vbox for chapter headings, section headings, and
  1923. % such:
  1924. %    1) We use \vbox rather than the earlier \line to permit
  1925. %       overlong headings to fold.
  1926. %    2) \hyphenpenalty is set to 10000 because hyphenation in a
  1927. %       heading is obnoxious; this forbids it.
  1928. %       3) Likewise, headings look best if no \parindent is used, and
  1929. %          if justification is not attempted.  Hence \raggedright.
  1930. \def\majorheading{\parsearg\majorheadingzzz}
  1931. \def\majorheadingzzz #1{%
  1932. {\advance\chapheadingskip by 10pt \chapbreak }%
  1933. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1934.                   \parindent=0pt\raggedright
  1935.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  1936. \def\chapheading{\parsearg\chapheadingzzz}
  1937. \def\chapheadingzzz #1{\chapbreak %
  1938. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1939.                   \parindent=0pt\raggedright
  1940.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  1941. \def\heading{\parsearg\secheadingi}
  1942. \def\subheading{\parsearg\subsecheadingi}
  1943. \def\subsubheading{\parsearg\subsubsecheadingi}
  1944. % These macros generate a chapter, section, etc. heading only
  1945. % (including whitespace, linebreaking, etc. around it),
  1946. % given all the information in convenient, parsed form.
  1947. %%% Args are the skip and penalty (usually negative)
  1948. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  1949. \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  1950. %%% Define plain chapter starts, and page on/off switching for it
  1951. % Parameter controlling skip before chapter headings (if needed)
  1952. \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
  1953. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  1954. \def\chappager{\par\vfill\supereject}
  1955. \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  1956. \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  1957. \def\CHAPPAGoff{
  1958. \global\let\pchapsepmacro=\chapbreak
  1959. \global\let\pagealignmacro=\chappager}
  1960. \def\CHAPPAGon{
  1961. \global\let\pchapsepmacro=\chappager
  1962. \global\let\pagealignmacro=\chappager
  1963. \global\def\HEADINGSon{\HEADINGSsingle}}
  1964. \def\CHAPPAGodd{
  1965. \global\let\pchapsepmacro=\chapoddpage
  1966. \global\let\pagealignmacro=\chapoddpage
  1967. \global\def\HEADINGSon{\HEADINGSdouble}}
  1968. \CHAPPAGon
  1969. \def\CHAPFplain{
  1970. \global\let\chapmacro=\chfplain
  1971. \global\let\unnumbchapmacro=\unnchfplain}
  1972. \def\chfplain #1#2{%
  1973.   \pchapsepmacro
  1974.     \chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1975.                      \parindent=0pt\raggedright
  1976.                      \rm #2\enspace #1}%
  1977.   \bigskip
  1978.   \penalty5000
  1979. \def\unnchfplain #1{%
  1980. \pchapsepmacro %
  1981. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1982.                   \parindent=0pt\raggedright
  1983.                   \rm #1\hfill}}\bigskip \par\penalty 10000 %
  1984. \CHAPFplain % The default
  1985. \def\unnchfopen #1{%
  1986. \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1987.                        \parindent=0pt\raggedright
  1988.                        \rm #1\hfill}}\bigskip \par\penalty 10000 %
  1989. \def\chfopen #1#2{\chapoddpage {\chapfonts
  1990. \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  1991. \par\penalty 5000 %
  1992. \def\CHAPFopen{
  1993. \global\let\chapmacro=\chfopen
  1994. \global\let\unnumbchapmacro=\unnchfopen}
  1995. % Parameter controlling skip before section headings.
  1996. \newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
  1997. \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  1998. \newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
  1999. \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  2000. % @paragraphindent  is defined for the Info formatting commands only.
  2001. \let\paragraphindent=\comment
  2002. % Section fonts are the base font at magstep2, which produces
  2003. % a size a bit more than 14 points in the default situation.
  2004. \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
  2005. \def\plainsecheading #1{\secheadingi {#1}}
  2006. \def\secheadingi #1{{\advance \secheadingskip by \parskip %
  2007. \secheadingbreak}%
  2008. {\secfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2009.                  \parindent=0pt\raggedright
  2010.                  \rm #1\hfill}}%
  2011. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  2012. % Subsection fonts are the base font at magstep1,
  2013. % which produces a size of 12 points.
  2014. \def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
  2015. \def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  2016. \subsecheadingbreak}%
  2017. {\subsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2018.                      \parindent=0pt\raggedright
  2019.                      \rm #1\hfill}}%
  2020. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  2021. \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
  2022.                   % Perhaps make sssec fonts scaled
  2023.                   % magstep half
  2024. \def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
  2025. \def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  2026. \subsecheadingbreak}%
  2027. {\subsubsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2028.                        \parindent=0pt\raggedright
  2029.                        \rm #1\hfill}}%
  2030. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
  2031. \message{toc printing,}
  2032. % Finish up the main text and prepare to read what we've written
  2033. % to \contentsfile.
  2034. \newskip\contentsrightmargin \contentsrightmargin=1in
  2035. \def\startcontents#1{%
  2036.    \pagealignmacro
  2037.    \immediate\closeout \contentsfile
  2038.    \ifnum \pageno>0
  2039.       \pageno = -1        % Request roman numbered pages.
  2040.    \fi
  2041.    % Don't need to put `Contents' or `Short Contents' in the headline.
  2042.    % It is abundantly clear what they are.
  2043.    \unnumbchapmacro{#1}\def\thischapter{}%
  2044.    \begingroup           % Set up to handle contents files properly.
  2045.       \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
  2046.       \raggedbottom             % Worry more about breakpoints than the bottom.
  2047.       \advance\hsize by -\contentsrightmargin % Don't use the full line length.
  2048. % Normal (long) toc.
  2049. \outer\def\contents{%
  2050.    \startcontents{Table of Contents}%
  2051.       \input \jobname.toc
  2052.    \endgroup
  2053.    \vfill \eject
  2054. % And just the chapters.
  2055. \outer\def\summarycontents{%
  2056.    \startcontents{Short Contents}%
  2057.       %
  2058.       \let\chapentry = \shortchapentry
  2059.       \let\unnumbchapentry = \shortunnumberedentry
  2060.       % We want a true roman here for the page numbers.
  2061.       \secfonts
  2062.       \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
  2063.       \rm
  2064.       \advance\baselineskip by 1pt % Open it up a little.
  2065.       \def\secentry ##1##2##3##4{}
  2066.       \def\unnumbsecentry ##1##2{}
  2067.       \def\subsecentry ##1##2##3##4##5{}
  2068.       \def\unnumbsubsecentry ##1##2{}
  2069.       \def\subsubsecentry ##1##2##3##4##5##6{}
  2070.       \def\unnumbsubsubsecentry ##1##2{}
  2071.       \input \jobname.toc
  2072.    \endgroup
  2073.    \vfill \eject
  2074. \let\shortcontents = \summarycontents
  2075. % These macros generate individual entries in the table of contents.
  2076. % The first argument is the chapter or section name.
  2077. % The last argument is the page number.
  2078. % The arguments in between are the chapter number, section number, ...
  2079. % Chapter-level things, for both the long and short contents.
  2080. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  2081. % See comments in \dochapentry re vbox and related settings
  2082. \def\shortchapentry#1#2#3{%
  2083.   \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
  2084. % Typeset the label for a chapter or appendix for the short contents.
  2085. % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
  2086. % We could simplify the code here by writing out an \appendixentry
  2087. % command in the toc file for appendices, instead of using \chapentry
  2088. % for both, but it doesn't seem worth it.
  2089. \setbox0 = \hbox{\shortcontrm Appendix }
  2090. \newdimen\shortappendixwidth \shortappendixwidth = \wd0
  2091. \def\shortchaplabel#1{%
  2092.   % We typeset #1 in a box of constant width, regardless of the text of
  2093.   % #1, so the chapter titles will come out aligned.
  2094.   \setbox0 = \hbox{#1}%
  2095.   \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
  2096.   % This space should be plenty, since a single number is .5em, and the
  2097.   % widest letter (M) is 1em, at least in the Computer Modern fonts.
  2098.   % (This space doesn't include the extra space that gets added after
  2099.   % the label; that gets put in in \shortchapentry above.)
  2100.   \advance\dimen0 by 1.1em
  2101.   \hbox to \dimen0{#1\hfil}%
  2102. \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
  2103. \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
  2104. % Sections.
  2105. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  2106. \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
  2107. % Subsections.
  2108. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  2109. \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
  2110. % And subsubsections.
  2111. \def\subsubsecentry#1#2#3#4#5#6{%
  2112.   \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  2113. \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
  2114. % This parameter controls the indentation of the various levels.
  2115. \newdimen\tocindent \tocindent = 3pc
  2116. % Now for the actual typesetting. In all these, #1 is the text and #2 is the
  2117. % page number.
  2118. % If the toc has to be broken over pages, we would want to be at chapters
  2119. % if at all possible; hence the \penalty.
  2120. \def\dochapentry#1#2{%
  2121.    \penalty-300 \vskip\baselineskip
  2122.    \begingroup
  2123.      \chapentryfonts
  2124.      \tocentry{#1}{\dopageno{#2}}%
  2125.    \endgroup
  2126.    \nobreak\vskip .25\baselineskip
  2127. \def\dosecentry#1#2{\begingroup
  2128.   \secentryfonts \leftskip=\tocindent
  2129.   \tocentry{#1}{\dopageno{#2}}%
  2130. \endgroup}
  2131. \def\dosubsecentry#1#2{\begingroup
  2132.   \subsecentryfonts \leftskip=2\tocindent
  2133.   \tocentry{#1}{\dopageno{#2}}%
  2134. \endgroup}
  2135. \def\dosubsubsecentry#1#2{\begingroup
  2136.   \subsubsecentryfonts \leftskip=3\tocindent
  2137.   \tocentry{#1}{\dopageno{#2}}%
  2138. \endgroup}
  2139. % Final typesetting of a toc entry; we use the same \entry macro as for
  2140. % the index entries, but we want to suppress hyphenation here.  (We
  2141. % can't do that in the \entry macro, since index entries might consist
  2142. % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
  2143. \def\tocentry#1#2{\begingroup
  2144.   \hyphenpenalty = 10000
  2145.   \entry{#1}{#2}%
  2146. \endgroup}
  2147. % Space between chapter (or whatever) number and the title.
  2148. \def\labelspace{\hskip1em \relax}
  2149. \def\dopageno#1{{\rm #1}}
  2150. \def\doshortpageno#1{{\rm #1}}
  2151. \def\chapentryfonts{\secfonts \rm}
  2152. \def\secentryfonts{\textfonts}
  2153. \let\subsecentryfonts = \textfonts
  2154. \let\subsubsecentryfonts = \textfonts
  2155. \message{environments,}
  2156. % Since these characters are used in examples, it should be an even number of
  2157. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  2158. % Furthermore, these definitions must come after we define our fonts.
  2159. \newbox\dblarrowbox    \newbox\longdblarrowbox
  2160. \newbox\pushcharbox    \newbox\bullbox
  2161. \newbox\equivbox       \newbox\errorbox
  2162. \let\ptexequiv = \equiv
  2163. %{\tentt
  2164. %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
  2165. %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
  2166. %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
  2167. %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
  2168. % Adapted from the manmac format (p.420 of TeXbook)
  2169. %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
  2170. %                                      depth .1ex\hfil}
  2171. \def\point{$\star$}
  2172. \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  2173. \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
  2174. \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  2175. \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  2176. % Adapted from the TeXbook's \boxit.
  2177. {\tentt \global\dimen0 = 3em}% Width of the box.
  2178. \dimen2 = .55pt % Thickness of rules
  2179. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  2180. \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  2181. \global\setbox\errorbox=\hbox to \dimen0{\hfil
  2182.    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  2183.    \advance\hsize by -2\dimen2 % Rules.
  2184.    \vbox{
  2185.       \hrule height\dimen2
  2186.       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
  2187.          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  2188.          \kern3pt\vrule width\dimen2}% Space to right.
  2189.       \hrule height\dimen2}
  2190.     \hfil}
  2191. % The @error{} command.
  2192. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  2193. % @tex ... @end tex    escapes into raw Tex temporarily.
  2194. % One exception: @ is still an escape character, so that @end tex works.
  2195. % But \@ or @@ will get a plain tex @ character.
  2196. \def\tex{\begingroup
  2197. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  2198. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  2199. \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
  2200. \catcode `\%=14
  2201. \catcode 43=12
  2202. \catcode`\"=12
  2203. \catcode`\==12
  2204. \catcode`\|=12
  2205. \catcode`\<=12
  2206. \catcode`\>=12
  2207. \escapechar=`\\
  2208. \let\{=\ptexlbrace
  2209. \let\}=\ptexrbrace
  2210. \let\.=\ptexdot
  2211. \let\*=\ptexstar
  2212. \let\dots=\ptexdots
  2213. \def\@{@}%
  2214. \let\bullet=\ptexbullet
  2215. \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
  2216. \let\L=\ptexL
  2217. \let\Etex=\endgroup}
  2218. % Define @lisp ... @endlisp.
  2219. % @lisp does a \begingroup so it can rebind things,
  2220. % including the definition of @endlisp (which normally is erroneous).
  2221. % Amount to narrow the margins by for @lisp.
  2222. \newskip\lispnarrowing \lispnarrowing=0.4in
  2223. % This is the definition that ^^M gets inside @lisp, @example, and other
  2224. % such environments.  \null is better than a space, since it doesn't
  2225. % have any width.
  2226. \def\lisppar{\null\endgraf}
  2227. % Make each space character in the input produce a normal interword
  2228. % space in the output.  Don't allow a line break at this space, as this
  2229. % is used only in environments like @example, where each line of input
  2230. % should produce a line of output anyway.
  2231. {\obeyspaces %
  2232. \gdef\sepspaces{\obeyspaces\let =\tie}}
  2233. % Define \obeyedspace to be our active space, whatever it is.  This is
  2234. % for use in \parsearg.
  2235. {\sepspaces %
  2236. \global\let\obeyedspace= }
  2237. % This space is always present above and below environments.
  2238. \newskip\envskipamount \envskipamount = 0pt
  2239. % Make spacing and below environment symmetrical.  We use \parskip here
  2240. % to help in doing that, since in @example-like environments \parskip
  2241. % is reset to zero; thus the \afterenvbreak inserts no space -- but the
  2242. % start of the next paragraph will insert \parskip
  2243. \def\aboveenvbreak{{\advance\envskipamount by \parskip
  2244. \endgraf \ifdim\lastskip<\envskipamount
  2245. \removelastskip \penalty-50 \vskip\envskipamount \fi}}
  2246. \let\afterenvbreak = \aboveenvbreak
  2247. % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
  2248. \let\nonarrowing=\relax
  2249. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2250. % \cartouche: draw rectangle w/rounded corners around argument
  2251. \font\circle=lcircle10
  2252. \newdimen\circthick
  2253. \newdimen\cartouter\newdimen\cartinner
  2254. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  2255. \circthick=\fontdimen8\circle
  2256. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  2257. \def\ctr{{\hskip 6pt\circle\char'010}}
  2258. \def\cbl{{\circle\char'012\hskip -6pt}}
  2259. \def\cbr{{\hskip 6pt\circle\char'011}}
  2260. \def\carttop{\hbox to \cartouter{\hskip\lskip
  2261.     \ctl\leaders\hrule height\circthick\hfil\ctr
  2262.     \hskip\rskip}}
  2263. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  2264.     \cbl\leaders\hrule height\circthick\hfil\cbr
  2265.     \hskip\rskip}}
  2266. \newskip\lskip\newskip\rskip
  2267. \long\def\cartouche{%
  2268. \begingroup
  2269.     \lskip=\leftskip \rskip=\rightskip
  2270.     \leftskip=0pt\rightskip=0pt %we want these *outside*.
  2271.     \cartinner=\hsize \advance\cartinner by-\lskip
  2272.                \advance\cartinner by-\rskip
  2273.     \cartouter=\hsize
  2274.     \advance\cartouter by 18pt % allow for 3pt kerns on either
  2275. %                     side, and for 6pt waste from
  2276. %                     each corner char
  2277.     \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  2278.     % Flag to tell @lisp, etc., not to narrow margin.
  2279.     \let\nonarrowing=\comment
  2280.     \vbox\bgroup
  2281.         \baselineskip=0pt\parskip=0pt\lineskip=0pt
  2282.         \carttop
  2283.         \hbox\bgroup
  2284.             \hskip\lskip
  2285.             \vrule\kern3pt
  2286.             \vbox\bgroup
  2287.                 \hsize=\cartinner
  2288.                 \kern3pt
  2289.                 \begingroup
  2290.                     \baselineskip=\normbskip
  2291.                     \lineskip=\normlskip
  2292.                     \parskip=\normpskip
  2293.                     \vskip -\parskip
  2294. \def\Ecartouche{%
  2295.                 \endgroup
  2296.                 \kern3pt
  2297.             \egroup
  2298.             \kern3pt\vrule
  2299.             \hskip\rskip
  2300.         \egroup
  2301.         \cartbot
  2302.     \egroup
  2303. \endgroup
  2304. % This macro is called at the beginning of all the @example variants,
  2305. % inside a group.
  2306. \def\nonfillstart{%
  2307.   \aboveenvbreak
  2308.   \inENV % This group ends at the end of the body
  2309.   \hfuzz = 12pt % Don't be fussy
  2310.   \sepspaces % Make spaces be word-separators rather than space tokens.
  2311.   \singlespace
  2312.   \let\par = \lisppar % don't ignore blank lines
  2313.   \obeylines % each line of input is a line of output
  2314.   \parskip = 0pt
  2315.   \parindent = 0pt
  2316.   \emergencystretch = 0pt % don't try to avoid overfull boxes
  2317.   % @cartouche defines \nonarrowing to inhibit narrowing
  2318.   % at next level down.
  2319.   \ifx\nonarrowing\relax
  2320.     \advance \leftskip by \lispnarrowing
  2321.     \exdentamount=\lispnarrowing
  2322.     \let\exdent=\nofillexdent
  2323.     \let\nonarrowing=\relax
  2324.   \fi
  2325. % To ending an @example-like environment, we first end the paragraph
  2326. % (via \afterenvbreak's vertical glue), and then the group.  That way we
  2327. % keep the zero \parskip that the environments set -- \parskip glue
  2328. % will be inserted at the beginning of the next paragraph in the
  2329. % document, after the environment.
  2330. \def\nonfillfinish{\afterenvbreak\endgroup}%
  2331. % This macro is
  2332. \def\lisp{\begingroup
  2333.   \nonfillstart
  2334.   \let\Elisp = \nonfillfinish
  2335.   \tt
  2336.   \rawbackslash % have \ input char produce \ char from current font
  2337.   \gobble
  2338. % Define the \E... control sequence only if we are inside the
  2339. % environment, so the error checking in \end will work.
  2340. % We must call \lisp last in the definition, since it reads the
  2341. % return following the @example (or whatever) command.
  2342. \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
  2343. \def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
  2344. \def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
  2345. % @smallexample and @smalllisp.  This is not used unless the @smallbook
  2346. % command is given.  Originally contributed by Pavel@xerox.
  2347. \def\smalllispx{\begingroup
  2348.   \nonfillstart
  2349.   \let\Esmalllisp = \nonfillfinish
  2350.   \let\Esmallexample = \nonfillfinish
  2351.   % Smaller interline space and fonts for small examples.
  2352.   \baselineskip 10pt
  2353.   \indexfonts \tt
  2354.   \rawbackslash % output the \ character from the current font
  2355.   \gobble
  2356. % This is @display; same as @lisp except use roman font.
  2357. \def\display{\begingroup
  2358.   \nonfillstart
  2359.   \let\Edisplay = \nonfillfinish
  2360.   \gobble
  2361. % This is @format; same as @display except don't narrow margins.
  2362. \def\format{\begingroup
  2363.   \let\nonarrowing = t
  2364.   \nonfillstart
  2365.   \let\Eformat = \nonfillfinish
  2366.   \gobble
  2367. % @flushleft (same as @format) and @flushright.
  2368. \def\flushleft{\begingroup
  2369.   \let\nonarrowing = t
  2370.   \nonfillstart
  2371.   \let\Eflushleft = \nonfillfinish
  2372.   \gobble
  2373. \def\flushright{\begingroup
  2374.   \let\nonarrowing = t
  2375.   \nonfillstart
  2376.   \let\Eflushright = \nonfillfinish
  2377.   \advance\leftskip by 0pt plus 1fill
  2378.   \gobble}
  2379. % @quotation does normal linebreaking and narrows the margins.
  2380. \def\quotation{%
  2381. \begingroup\inENV %This group ends at the end of the @quotation body
  2382. {\parskip=0pt  % because we will skip by \parskip too, later
  2383. \aboveenvbreak}%
  2384. \singlespace
  2385. \parindent=0pt
  2386. \let\Equotation = \nonfillfinish
  2387. % @cartouche defines \nonarrowing to inhibit narrowing
  2388. % at next level down.
  2389. \ifx\nonarrowing\relax
  2390. \advance \leftskip by \lispnarrowing
  2391. \advance \rightskip by \lispnarrowing
  2392. \exdentamount=\lispnarrowing
  2393. \let\nonarrowing=\relax
  2394. \message{defuns,}
  2395. % Define formatter for defuns
  2396. % First, allow user to change definition object font (\df) internally
  2397. \def\setdeffont #1 {\csname DEF#1\endcsname}
  2398. \newskip\defbodyindent \defbodyindent=.4in
  2399. \newskip\defargsindent \defargsindent=50pt
  2400. \newskip\deftypemargin \deftypemargin=12pt
  2401. \newskip\deflastargmargin \deflastargmargin=18pt
  2402. \newcount\parencount
  2403. % define \functionparens, which makes ( and ) and & do special things.
  2404. % \functionparens affects the group it is contained in.
  2405. \def\activeparens{%
  2406. \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
  2407. \catcode`\[=\active \catcode`\]=\active}
  2408. % Make control sequences which act like normal parenthesis chars.
  2409. \let\lparen = ( \let\rparen = )
  2410. {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  2411. % Be sure that we always have a definition for `(', etc.  For example,
  2412. % if the fn name has parens in it, \boldbrax will not be in effect yet,
  2413. % so TeX would otherwise complain about undefined control sequence.
  2414. \global\let(=\lparen \global\let)=\rparen
  2415. \global\let[=\lbrack \global\let]=\rbrack
  2416. \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  2417. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  2418. % Definitions of (, ) and & used in args for functions.
  2419. % This is the definition of ( outside of all parentheses.
  2420. \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
  2421. \global\advance\parencount by 1 }
  2422. % This is the definition of ( when already inside a level of parens.
  2423. \gdef\opnested{\char`\(\global\advance\parencount by 1 }
  2424. \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  2425. % also in that case restore the outer-level definition of (.
  2426. \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  2427. \global\advance \parencount by -1 }
  2428. % If we encounter &foo, then turn on ()-hacking afterwards
  2429. \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
  2430. \gdef\normalparens{\boldbrax\let&=\ampnr}
  2431. } % End of definition inside \activeparens
  2432. %% These parens (in \boldbrax) actually are a little bolder than the
  2433. %% contained text.  This is especially needed for [ and ]
  2434. \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
  2435. \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
  2436. % First, defname, which formats the header line itself.
  2437. % #1 should be the function name.
  2438. % #2 should be the type of definition, such as "Function".
  2439. \def\defname #1#2{%
  2440. % Get the values of \leftskip and \rightskip as they were
  2441. % outside the @def...
  2442. \dimen2=\leftskip
  2443. \advance\dimen2 by -\defbodyindent
  2444. \dimen3=\rightskip
  2445. \advance\dimen3 by -\defbodyindent
  2446. \noindent        %
  2447. \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
  2448. \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
  2449. \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
  2450. \parshape 2 0in \dimen0 \defargsindent \dimen1     %
  2451. % Now output arg 2 ("Function" or some such)
  2452. % ending at \deftypemargin from the right margin,
  2453. % but stuck inside a box of width 0 so it does not interfere with linebreaking
  2454. {% Adjust \hsize to exclude the ambient margins,
  2455. % so that \rightline will obey them.
  2456. \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
  2457. \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
  2458. % Make all lines underfull and no complaints:
  2459. \tolerance=10000 \hbadness=10000
  2460. \advance\leftskip by -\defbodyindent
  2461. \exdentamount=\defbodyindent
  2462. {\df #1}\enskip        % Generate function name
  2463. % Actually process the body of a definition
  2464. % #1 should be the terminating control sequence, such as \Edefun.
  2465. % #2 should be the "another name" control sequence, such as \defunx.
  2466. % #3 should be the control sequence that actually processes the header,
  2467. %    such as \defunheader.
  2468. \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2469. \medbreak %
  2470. % Define the end token that this defining construct specifies
  2471. % so that it will exit this group.
  2472. \def#1{\endgraf\endgroup\medbreak}%
  2473. \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
  2474. \parindent=0in
  2475. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2476. \exdentamount=\defbodyindent
  2477. \begingroup %
  2478. \catcode 61=\active %
  2479. \obeylines\activeparens\spacesplit#3}
  2480. \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
  2481. \medbreak %
  2482. % Define the end token that this defining construct specifies
  2483. % so that it will exit this group.
  2484. \def#1{\endgraf\endgroup\medbreak}%
  2485. \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
  2486. \parindent=0in
  2487. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2488. \exdentamount=\defbodyindent
  2489. \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
  2490. \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
  2491. \medbreak %
  2492. % Define the end token that this defining construct specifies
  2493. % so that it will exit this group.
  2494. \def#1{\endgraf\endgroup\medbreak}%
  2495. \def#2##1 ##2 {\def#4{##1}%
  2496. \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
  2497. \parindent=0in
  2498. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2499. \exdentamount=\defbodyindent
  2500. \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
  2501. % These parsing functions are similar to the preceding ones
  2502. % except that they do not make parens into active characters.
  2503. % These are used for "variables" since they have no arguments.
  2504. \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2505. \medbreak %
  2506. % Define the end token that this defining construct specifies
  2507. % so that it will exit this group.
  2508. \def#1{\endgraf\endgroup\medbreak}%
  2509. \def#2{\begingroup\obeylines\spacesplit#3}%
  2510. \parindent=0in
  2511. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2512. \exdentamount=\defbodyindent
  2513. \begingroup %
  2514. \catcode 61=\active %
  2515. \obeylines\spacesplit#3}
  2516. \def\defvrparsebody #1#2#3#4 {\begingroup\inENV %
  2517. \medbreak %
  2518. % Define the end token that this defining construct specifies
  2519. % so that it will exit this group.
  2520. \def#1{\endgraf\endgroup\medbreak}%
  2521. \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
  2522. \parindent=0in
  2523. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2524. \exdentamount=\defbodyindent
  2525. \begingroup\obeylines\spacesplit{#3{#4}}}
  2526. % This seems to work right in all cases.
  2527. \let\deftpparsebody=\defvrparsebody
  2528. % This fails to work.  When given `@deftp {Data Type} foo_t',
  2529. % it thinks the type name is just `f'.
  2530. %%% This is the same as all the others except for the last line.  We need
  2531. %%% to parse the arguments differently for @deftp, since the ``attributes''
  2532. %%% there are optional.
  2533. %%\def\deftpparsebody #1#2#3#4 {\begingroup\inENV %
  2534. %%\medbreak %
  2535. %%% Define the end token that this defining construct specifies
  2536. %%% so that it will exit this group.
  2537. %%\def#1{\endgraf\endgroup\medbreak}%
  2538. %%\def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
  2539. %%\parindent=0in
  2540. %%\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2541. %%\exdentamount=\defbodyindent
  2542. %%\begingroup\obeylines\parsetpheaderline{#3{#4}}}
  2543. %%{\obeylines %
  2544. %%  % Parse the type name and any attributes (field names, etc.).
  2545. %%  % #1 is the beginning of the macro call that will produce the output,
  2546. %%  %   i.e., \deftpheader{CLASS}; this is passed from \deftpparsebody.
  2547. %%  % #2 is the type name, e.g., `struct termios'.
  2548. %%  % #3 is the (possibly empty) attribute list.
  2549. %%  %
  2550. %%  \gdef\parsetpheaderline#1#2#3^^M{%
  2551. %%    \endgroup % Started in \deftpparsebody.
  2552. %%    %
  2553. %%    % If the attribute list is in fact empty, there will be no space after
  2554. %%    % #2; so we can't put a space in our TeX parameter list.  But if it
  2555. %%    % isn't empty, then #3 will begin with an unwanted space.
  2556. %%    \def\theargs{\ignorespaces #3}%
  2557. %%    %
  2558. %%    % Call the macro to produce the output.
  2559. %%    #1{#2}\theargs %
  2560. %%  }%
  2561. \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
  2562. \medbreak %
  2563. % Define the end token that this defining construct specifies
  2564. % so that it will exit this group.
  2565. \def#1{\endgraf\endgroup\medbreak}%
  2566. \def#2##1 ##2 {\def#4{##1}%
  2567. \begingroup\obeylines\spacesplit{#3{##2}}}%
  2568. \parindent=0in
  2569. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2570. \exdentamount=\defbodyindent
  2571. \begingroup\obeylines\spacesplit{#3{#5}}}
  2572. % Split up #2 at the first space token.
  2573. % call #1 with two arguments:
  2574. %  the first is all of #2 before the space token,
  2575. %  the second is all of #2 after that space token.
  2576. % If #2 contains no space token, all of it is passed as the first arg
  2577. % and the second is passed as empty.
  2578. {\obeylines
  2579. \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
  2580. \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
  2581. \ifx\relax #3%
  2582. #1{#2}{}\else #1{#2}{#3#4}\fi}}
  2583. % So much for the things common to all kinds of definitions.
  2584. % Define @defun.
  2585. % First, define the processing that is wanted for arguments of \defun
  2586. % Use this to expand the args and terminate the paragraph they make up
  2587. \def\defunargs #1{\functionparens \sl
  2588. % Expand, preventing hyphenation at `-' chars.
  2589. % Note that groups don't affect changes in \hyphenchar.
  2590. \hyphenchar\tensl=0
  2591. \hyphenchar\tensl=45
  2592. \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
  2593. \interlinepenalty=10000
  2594. \advance\rightskip by 0pt plus 1fil
  2595. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2596. \def\deftypefunargs #1{%
  2597. % Expand, preventing hyphenation at `-' chars.
  2598. % Note that groups don't affect changes in \hyphenchar.
  2599. \functionparens
  2600. \code{#1}%
  2601. \interlinepenalty=10000
  2602. \advance\rightskip by 0pt plus 1fil
  2603. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2604. % Do complete processing of one @defun or @defunx line already parsed.
  2605. % @deffn Command forward-char nchars
  2606. \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  2607. \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  2608. \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  2609. \catcode 61=\other % Turn off change made in \defparsebody
  2610. % @defun == @deffn Function
  2611. \def\defun{\defparsebody\Edefun\defunx\defunheader}
  2612. \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2613. \begingroup\defname {#1}{Function}%
  2614. \defunargs {#2}\endgroup %
  2615. \catcode 61=\other % Turn off change made in \defparsebody
  2616. % @deftypefun int foobar (int @var{foo}, float @var{bar})
  2617. \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
  2618. % #1 is the data type.  #2 is the name and args.
  2619. \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
  2620. % #1 is the data type, #2 the name, #3 the args.
  2621. \def\deftypefunheaderx #1#2 #3\relax{%
  2622. \doind {fn}{\code{#2}}% Make entry in function index
  2623. \begingroup\defname {\code{#1} #2}{Function}%
  2624. \deftypefunargs {#3}\endgroup %
  2625. \catcode 61=\other % Turn off change made in \defparsebody
  2626. % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
  2627. \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
  2628. % #1 is the classification.  #2 is the data type.  #3 is the name and args.
  2629. \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
  2630. % #1 is the classification, #2 the data type, #3 the name, #4 the args.
  2631. \def\deftypefnheaderx #1#2#3 #4\relax{%
  2632. \doind {fn}{\code{#3}}% Make entry in function index
  2633. \begingroup\defname {\code{#2} #3}{#1}%
  2634. \deftypefunargs {#4}\endgroup %
  2635. \catcode 61=\other % Turn off change made in \defparsebody
  2636. % @defmac == @deffn Macro
  2637. \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  2638. \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2639. \begingroup\defname {#1}{Macro}%
  2640. \defunargs {#2}\endgroup %
  2641. \catcode 61=\other % Turn off change made in \defparsebody
  2642. % @defspec == @deffn Special Form
  2643. \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  2644. \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2645. \begingroup\defname {#1}{Special Form}%
  2646. \defunargs {#2}\endgroup %
  2647. \catcode 61=\other % Turn off change made in \defparsebody
  2648. % This definition is run if you use @defunx
  2649. % anywhere other than immediately after a @defun or @defunx.
  2650. \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
  2651. \def\defunx #1 {\errmessage{@defunx in invalid context}}
  2652. \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
  2653. \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
  2654. \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
  2655. \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
  2656. % @defmethod, and so on
  2657. % @defop {Funny Method} foo-class frobnicate argument
  2658. \def\defop #1 {\def\defoptype{#1}%
  2659. \defopparsebody\Edefop\defopx\defopheader\defoptype}
  2660. \def\defopheader #1#2#3{%
  2661. \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
  2662. \begingroup\defname {#2}{\defoptype{} on #1}%
  2663. \defunargs {#3}\endgroup %
  2664. % @defmethod == @defop Method
  2665. \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  2666. \def\defmethodheader #1#2#3{%
  2667. \dosubind {fn}{\code{#2}}{on #1}% entry in function index
  2668. \begingroup\defname {#2}{Method on #1}%
  2669. \defunargs {#3}\endgroup %
  2670. % @defcv {Class Option} foo-class foo-flag
  2671. \def\defcv #1 {\def\defcvtype{#1}%
  2672. \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  2673. \def\defcvarheader #1#2#3{%
  2674. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2675. \begingroup\defname {#2}{\defcvtype{} of #1}%
  2676. \defvarargs {#3}\endgroup %
  2677. % @defivar == @defcv {Instance Variable}
  2678. \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
  2679. \def\defivarheader #1#2#3{%
  2680. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2681. \begingroup\defname {#2}{Instance Variable of #1}%
  2682. \defvarargs {#3}\endgroup %
  2683. % These definitions are run if you use @defmethodx, etc.,
  2684. % anywhere other than immediately after a @defmethod, etc.
  2685. \def\defopx #1 {\errmessage{@defopx in invalid context}}
  2686. \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
  2687. \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
  2688. \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
  2689. % Now @defvar
  2690. % First, define the processing that is wanted for arguments of @defvar.
  2691. % This is actually simple: just print them in roman.
  2692. % This must expand the args and terminate the paragraph they make up
  2693. \def\defvarargs #1{\normalparens #1%
  2694. \interlinepenalty=10000
  2695. \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
  2696. % @defvr Counter foo-count
  2697. \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
  2698. \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  2699. \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  2700. % @defvar == @defvr Variable
  2701. \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
  2702. \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2703. \begingroup\defname {#1}{Variable}%
  2704. \defvarargs {#2}\endgroup %
  2705. % @defopt == @defvr {User Option}
  2706. \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
  2707. \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2708. \begingroup\defname {#1}{User Option}%
  2709. \defvarargs {#2}\endgroup %
  2710. % @deftypevar int foobar
  2711. \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
  2712. % #1 is the data type.  #2 is the name.
  2713. \def\deftypevarheader #1#2{%
  2714. \doind {vr}{\code{#2}}% Make entry in variables index
  2715. \begingroup\defname {\code{#1} #2}{Variable}%
  2716. \interlinepenalty=10000
  2717. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2718. \endgroup}
  2719. % @deftypevr {Global Flag} int enable
  2720. \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
  2721. \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
  2722. \begingroup\defname {\code{#2} #3}{#1}
  2723. \interlinepenalty=10000
  2724. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2725. \endgroup}
  2726. % This definition is run if you use @defvarx
  2727. % anywhere other than immediately after a @defvar or @defvarx.
  2728. \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
  2729. \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
  2730. \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  2731. \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
  2732. \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
  2733. % Now define @deftp
  2734. % Args are printed in bold, a slight difference from @defvar.
  2735. \def\deftpargs #1{\bf \defvarargs{#1}}
  2736. % @deftp Class window height width ...
  2737. \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
  2738. \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  2739. \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  2740. % This definition is run if you use @deftpx, etc
  2741. % anywhere other than immediately after a @deftp, etc.
  2742. \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
  2743. \message{cross reference,}
  2744. % Define cross-reference macros
  2745. \newwrite \auxfile
  2746. \newif\ifhavexrefs  % True if xref values are known.
  2747. \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
  2748. % \setref{foo} defines a cross-reference point named foo.
  2749. \def\setref#1{%
  2750. %\dosetq{#1-title}{Ytitle}%
  2751. \dosetq{#1-pg}{Ypagenumber}%
  2752. \dosetq{#1-snt}{Ysectionnumberandtype}}
  2753. \def\unnumbsetref#1{%
  2754. %\dosetq{#1-title}{Ytitle}%
  2755. \dosetq{#1-pg}{Ypagenumber}%
  2756. \dosetq{#1-snt}{Ynothing}}
  2757. \def\appendixsetref#1{%
  2758. %\dosetq{#1-title}{Ytitle}%
  2759. \dosetq{#1-pg}{Ypagenumber}%
  2760. \dosetq{#1-snt}{Yappendixletterandtype}}
  2761. % \xref, \pxref, and \ref generate cross-references to specified points.
  2762. % For \xrefX, #1 is the node name, #2 the name of the Info
  2763. % cross-reference, #3 the printed node name, #4 the name of the Info
  2764. % file, #5 the name of the printed manual.  All but the node name can be
  2765. % omitted.
  2766. \def\pxref#1{see \xrefX[#1,,,,,,,]}
  2767. \def\xref#1{See \xrefX[#1,,,,,,,]}
  2768. \def\ref#1{\xrefX[#1,,,,,,,]}
  2769. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup%
  2770. \def\printedmanual{\ignorespaces #5}%
  2771. \def\printednodename{\ignorespaces #3}%
  2772. \setbox1=\hbox{\printedmanual}%
  2773. \setbox0=\hbox{\printednodename}%
  2774. \ifdim \wd0=0pt%
  2775. \def\printednodename{\ignorespaces #1}%
  2776. %%% Uncommment the following line to make the actual chapter or section title
  2777. %%% appear inside the square brackets.
  2778. %\def\printednodename{#1-title}%
  2779. % If we use \unhbox0 and \unhbox1 to print the node names, TeX does
  2780. % not insert empty discretionaries after hyphens, which means that it
  2781. % will not find a line break at a hyphen in a node names.  Since some
  2782. % manuals are best written with fairly long node names, containing
  2783. % hyphens, this is a loss.  Therefore, we simply give the text of
  2784. % the node name again, so it is as if TeX is seeing it for the first
  2785. % time.
  2786. \ifdim \wd1>0pt
  2787. section ``\printednodename'' in \cite{\printedmanual}%
  2788. \else%
  2789. \turnoffactive%
  2790. \refx{#1-snt}{} [\printednodename], page\tie\refx{#1-pg}{}%
  2791. \endgroup}
  2792. % \dosetq is the interface for calls from other macros
  2793. % Use \turnoffactive so that punctuation chars such as underscore
  2794. % work in node names.
  2795. \def\dosetq #1#2{{\let\folio=0 \turnoffactive%
  2796. \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
  2797. \next}}
  2798. % \internalsetq {foo}{page} expands into
  2799. % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
  2800. % When the aux file is read, ' is the escape character
  2801. \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
  2802. % Things to be expanded by \internalsetq
  2803. \def\Ypagenumber{\folio}
  2804. \def\Ytitle{\thischapter}
  2805. \def\Ynothing{}
  2806. \def\Ysectionnumberandtype{%
  2807. \ifnum\secno=0 Chapter\xreftie\the\chapno %
  2808. \else \ifnum \subsecno=0 Section\xreftie\the\chapno.\the\secno %
  2809. \else \ifnum \subsubsecno=0 %
  2810. Section\xreftie\the\chapno.\the\secno.\the\subsecno %
  2811. \else %
  2812. Section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
  2813. \fi \fi \fi }
  2814. \def\Yappendixletterandtype{%
  2815. \ifnum\secno=0 Appendix\xreftie'char\the\appendixno{}%
  2816. \else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %
  2817. \else \ifnum \subsubsecno=0 %
  2818. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
  2819. \else %
  2820. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
  2821. \fi \fi \fi }
  2822. \gdef\xreftie{'tie}
  2823. % Use TeX 3.0's \inputlineno to get the line number, for better error
  2824. % messages, but if we're using an old version of TeX, don't do anything.
  2825. \ifx\inputlineno\thisisundefined
  2826.   \let\linenumber = \empty % Non-3.0.
  2827. \else
  2828.   \def\linenumber{\the\inputlineno:\space}
  2829. % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  2830. % If its value is nonempty, SUFFIX is output afterward.
  2831. \def\refx#1#2{%
  2832.   \expandafter\ifx\csname X#1\endcsname\relax
  2833.     % If not defined, say something at least.
  2834.     $\langle$un\-de\-fined$\rangle$%
  2835.     \ifhavexrefs
  2836.       \message{\linenumber Undefined cross reference `#1'.}%
  2837.     \else
  2838.       \ifwarnedxrefs\else
  2839.         \global\warnedxrefstrue
  2840.         \message{Cross reference values unknown; you must run TeX again.}%
  2841.       \fi
  2842.     \fi
  2843.   \else
  2844.     % It's defined, so just use it.
  2845.     \csname X#1\endcsname
  2846.   \fi
  2847.   #2% Output the suffix in any case.
  2848. % Read the last existing aux file, if any.  No error if none exists.
  2849. % This is the macro invoked by entries in the aux file.
  2850. \def\xrdef #1#2{
  2851. {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
  2852. \def\readauxfile{%
  2853. \begingroup
  2854. \catcode `\^^@=\other
  2855. \catcode `\
  2856. =\other
  2857. \catcode `\
  2858. =\other
  2859. \catcode `\^^C=\other
  2860. \catcode `\^^D=\other
  2861. \catcode `\^^E=\other
  2862. \catcode `\^^F=\other
  2863. \catcode `\^^G=\other
  2864. \catcode `\^^H=\other
  2865. \catcode `\
  2866. =\other
  2867. \catcode `\^^L=\other
  2868. \catcode `\
  2869. =\other
  2870. \catcode `\
  2871. =\other
  2872. \catcode `\
  2873. =\other
  2874. \catcode `\
  2875. =\other
  2876. \catcode `\
  2877. =\other
  2878. \catcode `\
  2879. =\other
  2880. \catcode `\
  2881. =\other
  2882. \catcode `\
  2883. =\other
  2884. \catcode `\
  2885. =\other
  2886. \catcode `\
  2887. =\other
  2888. \catcode `\
  2889. =\other
  2890. \catcode `\
  2891. =\other
  2892. \catcode 26=\other
  2893. \catcode `\^^[=\other
  2894. \catcode `\^^\=\other
  2895. \catcode `\^^]=\other
  2896. \catcode `\^^^=\other
  2897. \catcode `\^^_=\other
  2898. \catcode `\@=\other
  2899. \catcode `\^=\other
  2900. \catcode `\~=\other
  2901. \catcode `\[=\other
  2902. \catcode `\]=\other
  2903. \catcode`\"=\other
  2904. \catcode`\_=\other
  2905. \catcode`\|=\other
  2906. \catcode`\<=\other
  2907. \catcode`\>=\other
  2908. \catcode `\$=\other
  2909. \catcode `\#=\other
  2910. \catcode `\&=\other
  2911. % `\+ does not work, so use 43.
  2912. \catcode 43=\other
  2913. % the aux file uses ' as the escape.
  2914. % Turn off \ as an escape so we do not lose on
  2915. % entries which were dumped with control sequences in their names.
  2916. % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
  2917. % Reference to such entries still does not work the way one would wish,
  2918. % but at least they do not bomb out when the aux file is read in.
  2919. \catcode `\{=1 \catcode `\}=2
  2920. \catcode `\%=\other
  2921. \catcode `\'=0
  2922. \catcode `\\=\other
  2923. \openin 1 \jobname.aux
  2924. \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
  2925. \global\warnedobstrue
  2926. % Open the new aux file.  Tex will close it automatically at exit.
  2927. \openout \auxfile=\jobname.aux
  2928. \endgroup}
  2929. % Footnotes.
  2930. \newcount \footnoteno
  2931. % The trailing space in the following definition for supereject is
  2932. % vital for proper filling; pages come out unaligned when you do a
  2933. % pagealignmacro call if that space before the closing brace is
  2934. % removed.
  2935. \def\supereject{\par\penalty -20000\footnoteno =0 }
  2936. % @footnotestyle is meaningful for info output only..
  2937. \let\footnotestyle=\comment
  2938. \let\ptexfootnote=\footnote
  2939. {\catcode `\@=11
  2940. % Auto-number footnotes.  Otherwise like plain.
  2941. \gdef\footnote{%
  2942.   \global\advance\footnoteno by \@ne
  2943.   \edef\thisfootno{$^{\the\footnoteno}$}%
  2944.   % In case the footnote comes at the end of a sentence, preserve the
  2945.   % extra spacing after we do the footnote number.
  2946.   \let\@sf\empty
  2947.   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  2948.   % Remove inadvertent blank space before typesetting the footnote number.
  2949.   \unskip
  2950.   \thisfootno\@sf
  2951.   \footnotezzz
  2952. % Don't bother with the trickery in plain.tex to not require the
  2953. % footnote text as a parameter.  Our footnotes don't need to be so general.
  2954. \long\gdef\footnotezzz#1{\insert\footins{%
  2955.   % We want to typeset this text as a normal paragraph, even if the
  2956.   % footnote reference occurs in (for example) a display environment.
  2957.   % So reset some parameters.
  2958.   \interlinepenalty\interfootnotelinepenalty
  2959.   \splittopskip\ht\strutbox % top baseline for broken footnotes
  2960.   \splitmaxdepth\dp\strutbox
  2961.   \floatingpenalty\@MM
  2962.   \leftskip\z@skip
  2963.   \rightskip\z@skip
  2964.   \spaceskip\z@skip
  2965.   \xspaceskip\z@skip
  2966.   \parindent\defaultparindent
  2967.   % Hang the footnote text off the number.
  2968.   \hang
  2969.   \textindent{\thisfootno}%
  2970.   % Don't crash into the line above the footnote text.  Since this
  2971.   % expands into a box, it must come within the paragraph, lest it
  2972.   % provide a place where TeX can split the footnote.
  2973.   \footstrut
  2974.   #1\strut}%
  2975. }%end \catcode `\@=11
  2976. % Set the baselineskip to #1, and the lineskip and strut size
  2977. % correspondingly.  There is no deep meaning behind these magic numbers
  2978. % used as factors; they just match (closely enough) what Knuth defined.
  2979. \def\lineskipfactor{.08333}
  2980. \def\strutheightpercent{.70833}
  2981. \def\strutdepthpercent {.29167}
  2982. \def\setleading#1{%
  2983.   \normalbaselineskip = #1\relax
  2984.   \normallineskip = \lineskipfactor\normalbaselineskip
  2985.   \normalbaselines
  2986.   \setbox\strutbox =\hbox{%
  2987.     \vrule width0pt height\strutheightpercent\baselineskip
  2988.                     depth \strutdepthpercent \baselineskip
  2989. % @| inserts a changebar to the left of the current line.  It should
  2990. % surround any changed text.  This approach does *not* work if the
  2991. % change spans more than two lines of output.  To handle that, we would
  2992. % have adopt a much more difficult approach (putting marks into the main
  2993. % vertical list for the beginning and end of each change).
  2994. \def\|{%
  2995.   % \vadjust can only be used in horizontal mode.
  2996.   \leavevmode
  2997.   % Append this vertical mode material after the current line in the output.
  2998.   \vadjust{%
  2999.     % We want to insert a rule with the height and depth of the current
  3000.     % leading; that is exactly what \strutbox is supposed to record.
  3001.     \vskip-\baselineskip
  3002.     %
  3003.     % \vadjust-items are inserted at the left edge of the type.  So
  3004.     % the \llap here moves out into the left-hand margin.
  3005.     \llap{%
  3006.       %
  3007.       % For a thicker or thinner bar, change the `1pt'.
  3008.       \vrule height\baselineskip width1pt
  3009.       %
  3010.       % This is the space between the bar and the text.
  3011.       \hskip 12pt
  3012.     }%
  3013. % For a final copy, take out the rectangles
  3014. % that mark overfull boxes (in case you have decided
  3015. % that the text looks ok even though it passes the margin).
  3016. \def\finalout{\overfullrule=0pt}
  3017. % End of control word definitions.
  3018. \message{and turning on texinfo input format.}
  3019. \def\openindices{%
  3020.    \newindex{cp}%
  3021.    \newcodeindex{fn}%
  3022.    \newcodeindex{vr}%
  3023.    \newcodeindex{tp}%
  3024.    \newcodeindex{ky}%
  3025.    \newcodeindex{pg}%
  3026. % Set some numeric style parameters, for 8.5 x 11 format.
  3027. %\hsize = 6.5in
  3028. \newdimen\defaultparindent \defaultparindent = 15pt
  3029. \parindent = \defaultparindent
  3030. \parskip 18pt plus 1pt
  3031. \setleading{15pt}
  3032. \advance\topskip by 1.2cm
  3033. % Prevent underfull vbox error messages.
  3034. \vbadness=10000
  3035. % Following George Bush, just get rid of widows and orphans.
  3036. \widowpenalty=10000
  3037. \clubpenalty=10000
  3038. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  3039. % using an old version of TeX, don't do anything.  We want the amount of
  3040. % stretch added to depend on the line length, hence the dependence on
  3041. % \hsize.  This makes it come to about 9pt for the 8.5x11 format.
  3042. \ifx\emergencystretch\thisisundefined
  3043.   % Allow us to assign to \emergencystretch anyway.
  3044.   \def\emergencystretch{\dimen0}%
  3045. \else
  3046.   \emergencystretch = \hsize
  3047.   \divide\emergencystretch by 45
  3048. % Use @smallbook to reset parameters for 7x9.5 format  (or else 7x9.25)
  3049. \def\smallbook{
  3050. % These values for secheadingskip and subsecheadingskip are
  3051. % experiments.  RJC 7 Aug 1992
  3052. \global\secheadingskip = 17pt plus 6pt minus 3pt
  3053. \global\subsecheadingskip = 14pt plus 6pt minus 3pt
  3054. \global\lispnarrowing = 0.3in
  3055. \setleading{12pt}
  3056. \advance\topskip by -1cm
  3057. \global\parskip 3pt plus 1pt
  3058. \global\hsize = 5in
  3059. \global\vsize=7.5in
  3060. \global\tolerance=700
  3061. \global\hfuzz=1pt
  3062. \global\contentsrightmargin=0pt
  3063. \global\pagewidth=\hsize
  3064. \global\pageheight=\vsize
  3065. \global\let\smalllisp=\smalllispx
  3066. \global\let\smallexample=\smalllispx
  3067. \global\def\Esmallexample{\Esmalllisp}
  3068. % Use @afourpaper to print on European A4 paper.
  3069. \def\afourpaper{
  3070. \global\tolerance=700
  3071. \global\hfuzz=1pt
  3072. \setleading{12pt}
  3073. \global\parskip 15pt plus 1pt
  3074. \global\vsize= 53\baselineskip
  3075. \advance\vsize by \topskip
  3076. %\global\hsize=   5.85in     % A4 wide 10pt
  3077. \global\hsize=  6.5in
  3078. \global\outerhsize=\hsize
  3079. \global\advance\outerhsize by 0.5in
  3080. \global\outervsize=\vsize
  3081. \global\advance\outervsize by 0.6in
  3082. \global\pagewidth=\hsize
  3083. \global\pageheight=\vsize
  3084. % Define macros to output various characters with catcode for normal text.
  3085. \catcode`\"=\other
  3086. \catcode`\~=\other
  3087. \catcode`\^=\other
  3088. \catcode`\_=\other
  3089. \catcode`\|=\other
  3090. \catcode`\<=\other
  3091. \catcode`\>=\other
  3092. \catcode`\+=\other
  3093. \def\normaldoublequote{"}
  3094. \def\normaltilde{~}
  3095. \def\normalcaret{^}
  3096. \def\normalunderscore{_}
  3097. \def\normalverticalbar{|}
  3098. \def\normalless{<}
  3099. \def\normalgreater{>}
  3100. \def\normalplus{+}
  3101. % This macro is used to make a character print one way in ttfont
  3102. % where it can probably just be output, and another way in other fonts,
  3103. % where something hairier probably needs to be done.
  3104. % #1 is what to print if we are indeed using \tt; #2 is what to print
  3105. % otherwise.  Since all the Computer Modern typewriter fonts have zero
  3106. % interword stretch (and shrink), and it is reasonable to expect all
  3107. % typewriter fonts to have this, we can check that font parameter.
  3108. \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
  3109. % Turn off all special characters except @
  3110. % (and those which the user can use as if they were ordinary).
  3111. % Most of these we simply print from the \tt font, but for some, we can
  3112. % use math or other variants that look better in normal text.
  3113. \catcode`\"=\active
  3114. \def\activedoublequote{{\tt \char '042}}
  3115. \let"=\activedoublequote
  3116. \catcode`\~=\active
  3117. \def~{{\tt \char '176}}
  3118. \chardef\hat=`\^
  3119. \catcode`\^=\active
  3120. \def^{{\tt \hat}}
  3121. \catcode`\_=\active
  3122. \def_{\ifusingtt\normalunderscore\_}
  3123. % Subroutine for the previous macro.
  3124. \def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
  3125. % \lvvmode is equivalent in function to \leavevmode.
  3126. % Using \leavevmode runs into trouble when written out to
  3127. % an index file due to the expansion of \leavevmode into ``\unhbox
  3128. % \voidb@x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
  3129. % magic tricks with @.
  3130. \def\lvvmode{\vbox to 0pt{}}
  3131. \catcode`\|=\active
  3132. \def|{{\tt \char '174}}
  3133. \chardef \less=`\<
  3134. \catcode`\<=\active
  3135. \def<{{\tt \less}}
  3136. \chardef \gtr=`\>
  3137. \catcode`\>=\active
  3138. \def>{{\tt \gtr}}
  3139. \catcode`\+=\active
  3140. \def+{{\tt \char 43}}
  3141. %\catcode 27=\active
  3142. %\def^^[{$\diamondsuit$}
  3143. % Used sometimes to turn off (effectively) the active characters
  3144. % even after parsing them.
  3145. \def\turnoffactive{\let"=\normaldoublequote
  3146. \let~=\normaltilde
  3147. \let^=\normalcaret
  3148. \let_=\normalunderscore
  3149. \let|=\normalverticalbar
  3150. \let<=\normalless
  3151. \let>=\normalgreater
  3152. \let+=\normalplus}
  3153. % Set up an active definition for =, but don't enable it most of the time.
  3154. {\catcode`\==\active
  3155. \global\def={{\tt \char 61}}}
  3156. \catcode`\@=0
  3157. % \rawbackslashxx output one backslash character in current font
  3158. \global\chardef\rawbackslashxx=`\\
  3159. %{\catcode`\\=\other
  3160. %@gdef@rawbackslashxx{\}}
  3161. % \rawbackslash redefines \ as input to do \rawbackslashxx.
  3162. {\catcode`\\=\active
  3163. @gdef@rawbackslash{@let\=@rawbackslashxx }}
  3164. % \normalbackslash outputs one backslash in fixed width font.
  3165. \def\normalbackslash{{\tt\rawbackslashxx}}
  3166. % Say @foo, not \foo, in error messages.
  3167. \escapechar=`\@
  3168. % \catcode 17=0   % Define control-q
  3169. \catcode`\\=\active
  3170. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  3171. % That is what \eatinput is for; after that, the `\' should revert to printing
  3172. % a backslash.
  3173. @gdef@eatinput input texinfo{@fixbackslash}
  3174. @global@let\ = @eatinput
  3175. % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  3176. % the first `\{ in the file would cause an error. This macro tries to fix
  3177. % that, assuming it is called before the first `\' could plausibly occur.
  3178. @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
  3179. %% These look ok in all fonts, so just make them not special.  The @rm below
  3180. %% makes sure that the current font starts out as the newly loaded cmr10
  3181. @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
  3182. @textfonts
  3183. @c Local variables:
  3184. @c page-delimiter: "^\\\\message"
  3185. @c End:
  3186.